1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
|
/*
* Copyright (C) 2024 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if !defined(__WPE_PLATFORM_H_INSIDE__) && !defined(BUILDING_WEBKIT)
#error "Only <wpe/wpe-platform.h> can be included directly."
#endif
#include <glib-object.h>
#include <wpe/WPEDefines.h>
G_BEGIN_DECLS
/**
* WPESettingsError:
* @WPE_SETTINGS_ERROR_INCORRECT_TYPE: Incorrect GVariantType for key
* @WPE_SETTINGS_ERROR_NOT_REGISTERED: Key has not been registered
* @WPE_SETTINGS_ERROR_ALREADY_REGISTERED: Key has already been registered
* @WPE_SETTINGS_ERROR_INVALID_VALUE: Failed to parse a value from a keyfile
*
* #WPESettings errors
*/
typedef enum {
WPE_SETTINGS_ERROR_INCORRECT_TYPE,
WPE_SETTINGS_ERROR_NOT_REGISTERED,
WPE_SETTINGS_ERROR_ALREADY_REGISTERED,
WPE_SETTINGS_ERROR_INVALID_VALUE,
} WPESettingsError;
#define WPE_SETTINGS_ERROR (wpe_settings_error_quark())
WPE_API GQuark wpe_settings_error_quark(void);
/**
* WPE_SETTING_FONT_NAME:
*
* String representing the font in the format of
* "name size", e.g. "Deja Vu Sans, 16"
*
* VariantType: string
*
* Default: Sans 10
*/
#define WPE_SETTING_FONT_NAME "/wpe-platform/font-name"
/**
* WPE_SETTING_DARK_MODE:
*
* Enables dark mode for websites.
*
* VariantType: boolean
*
* Default: false
*/
#define WPE_SETTING_DARK_MODE "/wpe-platform/dark-mode"
/**
* WPE_SETTING_DISABLE_ANIMATIONS:
*
* Disables animations on websites.
*
* VariantType: boolean
*
* Default: false
*/
#define WPE_SETTING_DISABLE_ANIMATIONS "/wpe-platform/disable-animations"
/**
* WPE_SETTING_FONT_ANTIALIAS:
*
* If antialiasing is applied to fonts.
*
* VariantType: boolean
*
* Default: true
*/
#define WPE_SETTING_FONT_ANTIALIAS "/wpe-platform/font-antialias"
/**
* WPESettingsHintingStyle:
* @WPE_SETTINGS_HINTING_STYLE_NONE
* @WPE_SETTINGS_HINTING_STYLE_SLIGHT
* @WPE_SETTINGS_HINTING_STYLE_MEDIUM
* @WPE_SETTINGS_HINTING_STYLE_FULL
*/
typedef enum {
WPE_SETTINGS_HINTING_STYLE_NONE,
WPE_SETTINGS_HINTING_STYLE_SLIGHT,
WPE_SETTINGS_HINTING_STYLE_MEDIUM,
WPE_SETTINGS_HINTING_STYLE_FULL,
} WPESettingsHintingStyle;
/**
* WPE_SETTING_FONT_HINTING_STYLE:
*
* Style of hinting to apply to font.
*
* VariantType: byte (WPESettingsHintingStyle)
*
* Default: WPE_SETTINGS_HINTING_STYLE_SLIGHT
*/
#define WPE_SETTING_FONT_HINTING_STYLE "/wpe-platform/font-hinting-style"
/**
* WPESettingsSubpixelLayout:
* @WPE_SETTINGS_SUBPIXEL_LAYOUT_RGB
* @WPE_SETTINGS_SUBPIXEL_LAYOUT_BGR
* @WPE_SETTINGS_SUBPIXEL_LAYOUT_VRGB
* @WPE_SETTINGS_SUBPIXEL_LAYOUT_VBGR
*/
typedef enum {
WPE_SETTINGS_SUBPIXEL_LAYOUT_RGB,
WPE_SETTINGS_SUBPIXEL_LAYOUT_BGR,
WPE_SETTINGS_SUBPIXEL_LAYOUT_VRGB,
WPE_SETTINGS_SUBPIXEL_LAYOUT_VBGR,
} WPESettingsSubpixelLayout;
/**
* WPE_SETTING_FONT_SUBPIXEL_LAYOUT:
*
* Layout of subpixels used for fonts.
*
* VariantType: byte (WPESettingsSubpixelLayout)
*
* Default: WPE_SETTINGS_SUBPIXEL_LAYOUT_RGB
*/
#define WPE_SETTING_FONT_SUBPIXEL_LAYOUT "/wpe-platform/font-subpixel-layout"
/**
* WPE_SETTING_FONT_DPI:
*
* DPI used for fonts.
*
* VariantType: double
*
* Default: 96.0
*/
#define WPE_SETTING_FONT_DPI "/wpe-platform/font-dpi"
/**
* WPE_SETTING_CURSOR_BLINK_TIME:
*
* Rate of cursor blinking in ms.
*
* Setting to 0 will disable blinking.
*
* VariantType: uint32
*
* Default: 1200
*/
#define WPE_SETTING_CURSOR_BLINK_TIME "/wpe-platform/cursor-blink-time"
/**
* WPE_SETTING_TOPLEVEL_DEFAULT_SIZE:
*
* The default size of the toplevel upon construction, represented as
* a pair of unsigned 32-bit integers (width, height).
*
* VariantType: (uu)
*
* Default: (1024, 768)
*/
#define WPE_SETTING_TOPLEVEL_DEFAULT_SIZE "/wpe-platform/toplevel-default-size"
/**
* WPE_SETTING_DOUBLE_CLICK_DISTANCE:
*
* The allowed distance travelled in either the x or the y coordinate of a
* button press event from the previous press to be considered a double click.
*
* VariantType: uint32
*
* Default: 5
*/
#define WPE_SETTING_DOUBLE_CLICK_DISTANCE "/wpe-platform/events/double-click/distance"
/**
* WPE_SETTING_DOUBLE_CLICK_TIME:
*
* The allowed time elapse since the previous button press event until the current
* press to be considered a double click.
*
* VariantType: uint32
*
* Default: 400
*/
#define WPE_SETTING_DOUBLE_CLICK_TIME "/wpe-platform/events/double-click/time"
/**
* WPE_SETTING_DRAG_THRESHOLD:
*
* The number of pixels the cursor travelled to activate a drag gesture.
*
* VariantType: uint32
*
* Default: 8
*/
#define WPE_SETTING_DRAG_THRESHOLD "/wpe-platform/events/gestures/drag-thresold"
/**
* WPE_SETTING_KEY_REPEAT_DELAY:
*
* The allowed delay in milliseconds to begin listening to a key repeat
* event since the start of handling the key.
*
* VariantType: uint32
*
* Default: 400
*/
#define WPE_SETTING_KEY_REPEAT_DELAY "/wpe-platform/events/key-repeat/delay"
/**
* WPE_SETTING_KEY_REPEAT_INTERVAL:
*
* The allowed interval in milliseconds on top of the key repeat delay to
* listen to a key repeat event.
*
* VariantType: uint32
*
* Default: 80
*/
#define WPE_SETTING_KEY_REPEAT_INTERVAL "/wpe-platform/events/key-repeat/interval"
/**
* WPESettingsSource:
* @WPE_SETTINGS_SOURCE_PLATFORM: Set by the platform
* @WPE_SETTINGS_SOURCE_APPLICATION: Set by the application
*
* Indicates the source of a settings change.
*/
typedef enum {
WPE_SETTINGS_SOURCE_PLATFORM,
WPE_SETTINGS_SOURCE_APPLICATION,
} WPESettingsSource;
#define WPE_TYPE_SETTINGS (wpe_settings_get_type())
WPE_API G_DECLARE_FINAL_TYPE(WPESettings, wpe_settings, WPE, SETTINGS, GObject)
WPE_API gboolean wpe_settings_register (WPESettings *settings,
const char *key,
const GVariantType *type,
GVariant *default_value,
GError **error);
WPE_API gboolean wpe_settings_load_from_keyfile (WPESettings *settings,
GKeyFile *keyfile,
GError **error);
WPE_API void wpe_settings_save_to_keyfile (WPESettings *settings,
GKeyFile *keyfile);
WPE_API gboolean wpe_settings_set_value (WPESettings *settings,
const char *key,
GVariant *value,
WPESettingsSource source,
GError **error);
WPE_API GVariant *wpe_settings_get_value (WPESettings *settings,
const char *key,
GError **error);
WPE_API gint32 wpe_settings_get_int32 (WPESettings *settings,
const char *key,
GError **error);
WPE_API gint64 wpe_settings_get_int64 (WPESettings *settings,
const char *key,
GError **error);
WPE_API guint8 wpe_settings_get_byte (WPESettings *settings,
const char *key,
GError **error);
WPE_API guint32 wpe_settings_get_uint32 (WPESettings *settings,
const char *key,
GError **error);
WPE_API guint64 wpe_settings_get_uint64 (WPESettings *settings,
const char *key,
GError **error);
WPE_API const char *wpe_settings_get_string (WPESettings *settings,
const char *key,
GError **error);
WPE_API gdouble wpe_settings_get_double (WPESettings *settings,
const char *key,
GError **error);
WPE_API gboolean wpe_settings_get_boolean (WPESettings *settings,
const char *key,
GError **error);
WPE_API gboolean wpe_settings_set_int32 (WPESettings *settings,
const char *key,
gint32 value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_int64 (WPESettings *settings,
const char *key,
gint64 value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_byte (WPESettings *settings,
const char *key,
guint8 value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_uint32 (WPESettings *settings,
const char *key,
guint32 value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_uint64 (WPESettings *settings,
const char *key,
guint64 value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_string (WPESettings *settings,
const char *key,
const char *value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_double (WPESettings *settings,
const char *key,
gdouble value,
WPESettingsSource source,
GError **error);
WPE_API gboolean wpe_settings_set_boolean (WPESettings *settings,
const char *key,
gboolean value,
WPESettingsSource source,
GError **error);
G_END_DECLS
|