Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a59ef54dc8 | |||
| 63692a491d | |||
| bbe79c1ef9 | |||
| 4b241f8da2 | |||
| bdd6ae3252 | |||
| 24a3ff3aef | |||
| ba988cd899 | |||
| 1bf1646d25 | |||
| 2c82151d65 | |||
| d2235b71f3 | |||
| 57135acd2d | |||
| 54c098761f | |||
| 2f98400b80 | |||
| ea7c9b93ea | |||
| 4317c008f0 | |||
| d605d9ae73 | |||
| c9fad25131 | |||
| 693200f1eb | |||
| 5f087a9dff | |||
| b9cde6f8ea | |||
| 86eece78b1 | |||
| 8cb50ac6e9 | |||
| e7c9e2060c |
+15
-12
@@ -17,12 +17,7 @@ stages:
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
|
||||
FEATURE_FLAGS: "-Dcloudproviders=true"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v18"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
|
||||
|
||||
.only-default:
|
||||
only:
|
||||
@@ -32,14 +27,14 @@ variables:
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
|
||||
stage: .pre
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
.build-fedora-default:
|
||||
image: $FEDORA_IMAGE
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
@@ -71,7 +66,11 @@ fedora-x86_64:
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
|
||||
-Dx11-backend=true
|
||||
-Dwayland-backend=true
|
||||
-Dbroadway-backend=true
|
||||
-Dvulkan=yes
|
||||
-Dprofiler=true
|
||||
_build
|
||||
- ninja -C _build
|
||||
@@ -85,7 +84,11 @@ release-build:
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
|
||||
-Dx11-backend=true
|
||||
-Dwayland-backend=true
|
||||
-Dbroadway-backend=true
|
||||
-Dvulkan=yes
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
@@ -114,7 +117,7 @@ msys2-mingw32:
|
||||
CHERE_INVOKING: "yes"
|
||||
|
||||
.flatpak-defaults:
|
||||
image: $FLATPAK_IMAGE
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
|
||||
stage: flatpak
|
||||
allow_failure: true
|
||||
tags:
|
||||
@@ -168,7 +171,7 @@ flatpak-master:icon-browser:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
stage: analysis
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug"
|
||||
@@ -181,7 +184,7 @@ static-scan:
|
||||
allow_failure: true
|
||||
|
||||
reference:
|
||||
image: $DOCS_IMAGE
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19
|
||||
stage: docs
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
|
||||
@@ -42,7 +42,6 @@ RUN dnf -y install \
|
||||
json-glib-devel \
|
||||
lcov \
|
||||
libattr-devel \
|
||||
libcloudproviders-devel \
|
||||
libepoxy-devel \
|
||||
libffi-devel \
|
||||
libmount-devel \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v20
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
|
||||
@@ -357,9 +357,6 @@ gdk_device_get_name
|
||||
gdk_device_get_vendor_id
|
||||
gdk_device_get_product_id
|
||||
gdk_device_get_source
|
||||
gdk_device_set_key
|
||||
gdk_device_get_key
|
||||
gdk_device_set_axis_use
|
||||
gdk_device_get_axis_use
|
||||
gdk_device_get_associated_device
|
||||
gdk_device_list_slave_devices
|
||||
@@ -367,7 +364,6 @@ gdk_device_get_device_type
|
||||
gdk_device_get_display
|
||||
gdk_device_get_has_cursor
|
||||
gdk_device_get_n_axes
|
||||
gdk_device_get_n_keys
|
||||
gdk_device_get_axes
|
||||
gdk_device_get_seat
|
||||
gdk_device_get_num_touches
|
||||
@@ -498,6 +494,7 @@ gdk_event_get_modifier_state
|
||||
gdk_event_get_position
|
||||
gdk_event_get_axes
|
||||
gdk_event_get_axis
|
||||
gdk_event_get_history
|
||||
gdk_event_get_pointer_emulated
|
||||
gdk_event_triggers_context_menu
|
||||
gdk_button_event_get_button
|
||||
@@ -529,7 +526,6 @@ gdk_touchpad_event_get_pinch_scale
|
||||
gdk_pad_event_get_axis_value
|
||||
gdk_pad_event_get_button
|
||||
gdk_pad_event_get_group_mode
|
||||
gdk_motion_event_get_history
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_events_get_angle
|
||||
|
||||
@@ -73,8 +73,8 @@ gdk_broadway_device_init (GdkBroadwayDevice *device_core)
|
||||
|
||||
device = GDK_DEVICE (device_core);
|
||||
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+9
-232
@@ -51,9 +51,7 @@ typedef struct _GdkAxisInfo GdkAxisInfo;
|
||||
|
||||
struct _GdkAxisInfo
|
||||
{
|
||||
char *label;
|
||||
GdkAxisUse use;
|
||||
|
||||
gdouble min_axis;
|
||||
gdouble max_axis;
|
||||
gdouble min_value;
|
||||
@@ -366,19 +364,10 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
G_TYPE_NONE, 1, GDK_TYPE_DEVICE_TOOL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_axis_info_clear (gpointer data)
|
||||
{
|
||||
GdkAxisInfo *info = data;
|
||||
|
||||
g_free (info->label);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_init (GdkDevice *device)
|
||||
{
|
||||
device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
|
||||
g_array_set_clear_func (device->axes, gdk_device_axis_info_clear);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -393,7 +382,6 @@ gdk_device_finalize (GObject *object)
|
||||
}
|
||||
|
||||
g_clear_pointer (&device->name, g_free);
|
||||
g_clear_pointer (&device->keys, g_free);
|
||||
g_clear_pointer (&device->vendor_id, g_free);
|
||||
g_clear_pointer (&device->product_id, g_free);
|
||||
|
||||
@@ -684,79 +672,6 @@ gdk_device_get_source (GdkDevice *device)
|
||||
return device->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_n_keys:
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Returns the number of keys the device currently has.
|
||||
*
|
||||
* Returns: the number of keys.
|
||||
**/
|
||||
gint
|
||||
gdk_device_get_n_keys (GdkDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
|
||||
|
||||
return device->num_keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_key:
|
||||
* @device: a #GdkDevice.
|
||||
* @index_: the index of the macro button to get.
|
||||
* @keyval: (out): return value for the keyval.
|
||||
* @modifiers: (out): return value for modifiers.
|
||||
*
|
||||
* If @index_ has a valid keyval, this function will return %TRUE
|
||||
* and fill in @keyval and @modifiers with the keyval settings.
|
||||
*
|
||||
* Returns: %TRUE if keyval is set for @index.
|
||||
**/
|
||||
gboolean
|
||||
gdk_device_get_key (GdkDevice *device,
|
||||
guint index_,
|
||||
guint *keyval,
|
||||
GdkModifierType *modifiers)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (index_ < device->num_keys, FALSE);
|
||||
|
||||
if (!device->keys[index_].keyval &&
|
||||
!device->keys[index_].modifiers)
|
||||
return FALSE;
|
||||
|
||||
if (keyval)
|
||||
*keyval = device->keys[index_].keyval;
|
||||
|
||||
if (modifiers)
|
||||
*modifiers = device->keys[index_].modifiers;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_set_key:
|
||||
* @device: a #GdkDevice
|
||||
* @index_: the index of the macro button to set
|
||||
* @keyval: the keyval to generate
|
||||
* @modifiers: the modifiers to set
|
||||
*
|
||||
* Specifies the X key event to generate when a macro button of a device
|
||||
* is pressed.
|
||||
**/
|
||||
void
|
||||
gdk_device_set_key (GdkDevice *device,
|
||||
guint index_,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (index_ < device->num_keys);
|
||||
|
||||
device->keys[index_].keyval = keyval;
|
||||
device->keys[index_].modifiers = modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_axis_use:
|
||||
* @device: a pointer #GdkDevice.
|
||||
@@ -781,47 +696,6 @@ gdk_device_get_axis_use (GdkDevice *device,
|
||||
return info->use;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_set_axis_use:
|
||||
* @device: a pointer #GdkDevice
|
||||
* @index_: the index of the axis
|
||||
* @use: specifies how the axis is used
|
||||
*
|
||||
* Specifies how an axis of a device is used.
|
||||
**/
|
||||
void
|
||||
gdk_device_set_axis_use (GdkDevice *device,
|
||||
guint index_,
|
||||
GdkAxisUse use)
|
||||
{
|
||||
GdkAxisInfo *info;
|
||||
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
|
||||
g_return_if_fail (index_ < device->axes->len);
|
||||
|
||||
info = &g_array_index (device->axes, GdkAxisInfo, index_);
|
||||
info->use = use;
|
||||
|
||||
switch ((guint) use)
|
||||
{
|
||||
case GDK_AXIS_X:
|
||||
case GDK_AXIS_Y:
|
||||
info->min_axis = 0;
|
||||
info->max_axis = 0;
|
||||
break;
|
||||
case GDK_AXIS_XTILT:
|
||||
case GDK_AXIS_YTILT:
|
||||
info->min_axis = -1;
|
||||
info->max_axis = 1;
|
||||
break;
|
||||
default:
|
||||
info->min_axis = 0;
|
||||
info->max_axis = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_display:
|
||||
* @device: a #GdkDevice
|
||||
@@ -987,89 +861,6 @@ gdk_device_get_n_axes (GdkDevice *device)
|
||||
return device->axes->len;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_axis_names:
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Returns a null-terminated array of strings, containing the labels for
|
||||
* the axes that @device currently has.
|
||||
* If the device has no axes, %NULL is returned.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A null-terminated string array,
|
||||
* free with g_strfreev().
|
||||
**/
|
||||
char **
|
||||
gdk_device_get_axis_names (GdkDevice *device)
|
||||
{
|
||||
GPtrArray *axes;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
|
||||
|
||||
if (device->axes->len == 0)
|
||||
return NULL;
|
||||
|
||||
axes = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; i < device->axes->len; i++)
|
||||
{
|
||||
GdkAxisInfo axis_info;
|
||||
|
||||
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
|
||||
g_ptr_array_add (axes, g_strdup (axis_info.label));
|
||||
}
|
||||
|
||||
g_ptr_array_add (axes, NULL);
|
||||
|
||||
return (char **) g_ptr_array_free (axes, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_axis_value: (skip)
|
||||
* @device: a pointer #GdkDevice.
|
||||
* @axes: (array): pointer to an array of axes
|
||||
* @axis_label: name of the label
|
||||
* @value: (out): location to store the found value.
|
||||
*
|
||||
* Interprets an array of double as axis values for a given device,
|
||||
* and locates the value in the array for a given axis label, as returned
|
||||
* by gdk_device_get_axes()
|
||||
*
|
||||
* Returns: %TRUE if the given axis use was found, otherwise %FALSE.
|
||||
**/
|
||||
gboolean
|
||||
gdk_device_get_axis_value (GdkDevice *device,
|
||||
gdouble *axes,
|
||||
const char *axis_label,
|
||||
gdouble *value)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
|
||||
|
||||
if (axes == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < device->axes->len; i++)
|
||||
{
|
||||
GdkAxisInfo axis_info;
|
||||
|
||||
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
|
||||
|
||||
if (!g_str_equal (axis_info.label, axis_label))
|
||||
continue;
|
||||
|
||||
if (value)
|
||||
*value = axes[i];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_axis: (skip)
|
||||
* @device: a #GdkDevice
|
||||
@@ -1206,7 +997,6 @@ _gdk_device_reset_axes (GdkDevice *device)
|
||||
|
||||
guint
|
||||
_gdk_device_add_axis (GdkDevice *device,
|
||||
const char *label_name,
|
||||
GdkAxisUse use,
|
||||
gdouble min_value,
|
||||
gdouble max_value,
|
||||
@@ -1216,7 +1006,6 @@ _gdk_device_add_axis (GdkDevice *device,
|
||||
guint pos;
|
||||
|
||||
axis_info.use = use;
|
||||
axis_info.label = g_strdup (label_name);
|
||||
axis_info.min_value = min_value;
|
||||
axis_info.max_value = max_value;
|
||||
axis_info.resolution = resolution;
|
||||
@@ -1252,12 +1041,11 @@ _gdk_device_add_axis (GdkDevice *device,
|
||||
|
||||
void
|
||||
_gdk_device_get_axis_info (GdkDevice *device,
|
||||
guint index_,
|
||||
const char **label_name,
|
||||
GdkAxisUse *use,
|
||||
gdouble *min_value,
|
||||
gdouble *max_value,
|
||||
gdouble *resolution)
|
||||
guint index_,
|
||||
GdkAxisUse *use,
|
||||
gdouble *min_value,
|
||||
gdouble *max_value,
|
||||
gdouble *resolution)
|
||||
{
|
||||
GdkAxisInfo *info;
|
||||
|
||||
@@ -1266,23 +1054,12 @@ _gdk_device_get_axis_info (GdkDevice *device,
|
||||
|
||||
info = &g_array_index (device->axes, GdkAxisInfo, index_);
|
||||
|
||||
*label_name = info->label;
|
||||
*use = info->use;
|
||||
*min_value = info->min_value;
|
||||
*max_value = info->max_value;
|
||||
*resolution = info->resolution;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_set_keys (GdkDevice *device,
|
||||
guint num_keys)
|
||||
{
|
||||
g_free (device->keys);
|
||||
|
||||
device->num_keys = num_keys;
|
||||
device->keys = g_new0 (GdkDeviceKey, num_keys);
|
||||
}
|
||||
|
||||
static GdkAxisInfo *
|
||||
find_axis_info (GArray *array,
|
||||
GdkAxisUse use)
|
||||
@@ -1303,10 +1080,10 @@ find_axis_info (GArray *array,
|
||||
|
||||
gboolean
|
||||
_gdk_device_translate_surface_coord (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
gdouble *axis_value)
|
||||
GdkSurface *surface,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
gdouble *axis_value)
|
||||
{
|
||||
GdkAxisInfo axis_info;
|
||||
GdkAxisInfo *axis_info_x, *axis_info_y;
|
||||
|
||||
+4
-26
@@ -85,22 +85,20 @@ typedef enum {
|
||||
GDK_DEVICE_TYPE_FLOATING
|
||||
} GdkDeviceType;
|
||||
|
||||
/* We don't allocate each coordinate this big, but we use it to
|
||||
* be ANSI compliant and avoid accessing past the defined limits.
|
||||
*/
|
||||
#define GDK_MAX_TIMECOORD_AXES 128
|
||||
|
||||
/**
|
||||
* GdkTimeCoord:
|
||||
* @time: The timestamp for this event.
|
||||
* @axes: the values of the device’s axes.
|
||||
* @flags: Flags indicating what axes are present
|
||||
* @axes: axis values
|
||||
*
|
||||
* A #GdkTimeCoord stores a single event in a motion history.
|
||||
*/
|
||||
struct _GdkTimeCoord
|
||||
{
|
||||
guint32 time;
|
||||
gdouble axes[GDK_MAX_TIMECOORD_AXES];
|
||||
GdkAxisFlags flags;
|
||||
double axes[GDK_AXIS_LAST];
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -115,26 +113,9 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkInputSource gdk_device_get_source (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gdk_device_get_n_keys (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_key (GdkDevice *device,
|
||||
guint index_,
|
||||
guint *keyval,
|
||||
GdkModifierType *modifiers);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_set_key (GdkDevice *device,
|
||||
guint index_,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
|
||||
guint index_);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_set_axis_use (GdkDevice *device,
|
||||
guint index_,
|
||||
GdkAxisUse use);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -150,11 +131,8 @@ GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gdk_device_get_n_axes (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
char ** gdk_device_get_axis_names (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_axis_value (GdkDevice *device,
|
||||
gdouble *axes,
|
||||
const char *axis_label,
|
||||
gdouble *value);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
+5
-19
@@ -31,13 +31,6 @@ G_BEGIN_DECLS
|
||||
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
|
||||
|
||||
typedef struct _GdkDeviceClass GdkDeviceClass;
|
||||
typedef struct _GdkDeviceKey GdkDeviceKey;
|
||||
|
||||
struct _GdkDeviceKey
|
||||
{
|
||||
guint keyval;
|
||||
GdkModifierType modifiers;
|
||||
};
|
||||
|
||||
struct _GdkDevice
|
||||
{
|
||||
@@ -46,9 +39,7 @@ struct _GdkDevice
|
||||
gchar *name;
|
||||
GdkInputSource source;
|
||||
gboolean has_cursor;
|
||||
gint num_keys;
|
||||
GdkAxisFlags axis_flags;
|
||||
GdkDeviceKey *keys;
|
||||
GdkDisplay *display;
|
||||
/* Paired master for master,
|
||||
* associated master for slaves
|
||||
@@ -106,21 +97,16 @@ void _gdk_device_set_associated_device (GdkDevice *device,
|
||||
|
||||
void _gdk_device_reset_axes (GdkDevice *device);
|
||||
guint _gdk_device_add_axis (GdkDevice *device,
|
||||
const char *label_atom,
|
||||
GdkAxisUse use,
|
||||
gdouble min_value,
|
||||
gdouble max_value,
|
||||
gdouble resolution);
|
||||
void _gdk_device_get_axis_info (GdkDevice *device,
|
||||
guint index,
|
||||
const char**label_atom,
|
||||
GdkAxisUse *use,
|
||||
gdouble *min_value,
|
||||
gdouble *max_value,
|
||||
gdouble *resolution);
|
||||
|
||||
void _gdk_device_set_keys (GdkDevice *device,
|
||||
guint num_keys);
|
||||
guint index,
|
||||
GdkAxisUse *use,
|
||||
gdouble *min_value,
|
||||
gdouble *max_value,
|
||||
gdouble *resolution);
|
||||
|
||||
gboolean _gdk_device_translate_surface_coord (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
|
||||
+149
-17
@@ -619,6 +619,114 @@ _gdk_event_unqueue (GdkDisplay *display)
|
||||
return event;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the last N events in the event queue are smooth scroll events
|
||||
* for the same surface and device, combine them into one.
|
||||
*/
|
||||
void
|
||||
gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
{
|
||||
GList *l;
|
||||
GdkSurface *surface = NULL;
|
||||
GdkDevice *device = NULL;
|
||||
GdkEvent *last_event = NULL;
|
||||
GList *scrolls = NULL;
|
||||
double delta_x, delta_y;
|
||||
GArray *history = NULL;
|
||||
GdkTimeCoord hist;
|
||||
|
||||
l = g_queue_peek_tail_link (&display->queued_events);
|
||||
|
||||
while (l)
|
||||
{
|
||||
GdkEvent *event = l->data;
|
||||
|
||||
if (event->flags & GDK_EVENT_PENDING)
|
||||
break;
|
||||
|
||||
if (event->event_type != GDK_SCROLL ||
|
||||
gdk_scroll_event_get_direction (event) != GDK_SCROLL_SMOOTH)
|
||||
break;
|
||||
|
||||
if (surface != NULL &&
|
||||
surface != event->surface)
|
||||
break;
|
||||
|
||||
if (device != NULL &&
|
||||
device != event->device)
|
||||
break;
|
||||
|
||||
if (!last_event)
|
||||
last_event = event;
|
||||
|
||||
surface = event->surface;
|
||||
device = event->device;
|
||||
scrolls = l;
|
||||
|
||||
l = l->prev;
|
||||
}
|
||||
|
||||
delta_x = delta_y = 0;
|
||||
|
||||
while (scrolls && scrolls->next != NULL)
|
||||
{
|
||||
GdkEvent *event = scrolls->data;
|
||||
GList *next = scrolls->next;
|
||||
double dx, dy;
|
||||
|
||||
if (!history)
|
||||
history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
|
||||
|
||||
gdk_scroll_event_get_deltas (event, &dx, &dy);
|
||||
delta_x += dx;
|
||||
delta_y += dy;
|
||||
|
||||
memset (&hist, 0, sizeof (GdkTimeCoord));
|
||||
hist.time = gdk_event_get_time (event);
|
||||
hist.flags = GDK_AXIS_FLAG_DELTA_X | GDK_AXIS_FLAG_DELTA_Y;
|
||||
hist.axes[GDK_AXIS_DELTA_X] = dx;
|
||||
hist.axes[GDK_AXIS_DELTA_Y] = dy;
|
||||
|
||||
g_array_append_val (history, hist);
|
||||
|
||||
gdk_event_unref (event);
|
||||
g_queue_delete_link (&display->queued_events, scrolls);
|
||||
scrolls = next;
|
||||
}
|
||||
|
||||
if (scrolls)
|
||||
{
|
||||
GdkEvent *old_event, *event;
|
||||
double dx, dy;
|
||||
|
||||
old_event = scrolls->data;
|
||||
|
||||
gdk_scroll_event_get_deltas (old_event, &dx, &dy);
|
||||
event = gdk_scroll_event_new (surface,
|
||||
device,
|
||||
gdk_event_get_source_device (old_event),
|
||||
gdk_event_get_device_tool (old_event),
|
||||
gdk_event_get_time (old_event),
|
||||
gdk_event_get_modifier_state (old_event),
|
||||
delta_x + dx,
|
||||
delta_y + dy,
|
||||
gdk_scroll_event_is_stop (old_event));
|
||||
|
||||
((GdkScrollEvent *)event)->history = history;
|
||||
|
||||
g_queue_delete_link (&display->queued_events, scrolls);
|
||||
g_queue_push_tail (&display->queued_events, event);
|
||||
}
|
||||
|
||||
if (g_queue_get_length (&display->queued_events) == 1 &&
|
||||
g_queue_peek_head_link (&display->queued_events) == scrolls)
|
||||
{
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
if (clock) /* might be NULL if surface was destroyed */
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_motion_event_push_history (GdkEvent *event,
|
||||
GdkEvent *history_event)
|
||||
@@ -634,14 +742,20 @@ gdk_motion_event_push_history (GdkEvent *event,
|
||||
device = gdk_event_get_device (history_event);
|
||||
n_axes = gdk_device_get_n_axes (device);
|
||||
|
||||
for (i = 0; i <= MIN (n_axes, GDK_MAX_TIMECOORD_AXES); i++)
|
||||
gdk_event_get_axis (history_event, i, &hist.axes[i]);
|
||||
memset (&hist, 0, sizeof (GdkTimeCoord));
|
||||
hist.time = gdk_event_get_time (history_event);
|
||||
hist.flags = gdk_device_get_axes (device);
|
||||
|
||||
for (i = 0; i < n_axes; i++)
|
||||
{
|
||||
GdkAxisUse use = gdk_device_get_axis_use (device, i);
|
||||
gdk_event_get_axis (history_event, use, &hist.axes[use]);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (!self->history))
|
||||
self->history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
|
||||
|
||||
g_array_append_val (self->history, hist);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -710,7 +824,7 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
|
||||
{
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (pending_motion_surface);
|
||||
if (clock) /* might be NULL if surface was destroyed */
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2158,6 +2272,8 @@ gdk_scroll_event_finalize (GdkEvent *event)
|
||||
GdkScrollEvent *self = (GdkScrollEvent *) event;
|
||||
|
||||
g_clear_object (&self->tool);
|
||||
if (self->history)
|
||||
g_array_free (self->history, TRUE);
|
||||
|
||||
GDK_EVENT_SUPER (self)->finalize (event);
|
||||
}
|
||||
@@ -2777,35 +2893,51 @@ gdk_motion_event_new (GdkSurface *surface,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_motion_event_get_history:
|
||||
* @event: (type GdkMotionEvent): a motion #GdkEvent
|
||||
* gdk_event_get_history:
|
||||
* @event: a motion or scroll #GdkEvent
|
||||
* @out_n_coords: (out): Return location for the length of the returned array
|
||||
*
|
||||
* Retrieves the history of the @event motion, as a list of time and
|
||||
* coordinates.
|
||||
* Retrieves the history of the @event, as a list of time and coordinates.
|
||||
*
|
||||
* The history includes events that are not delivered to the application
|
||||
* because they occurred in the same frame as @event.
|
||||
*
|
||||
* Note that only motion and scroll events record history, and motion
|
||||
* events only if one of the mouse buttons is down.
|
||||
*
|
||||
* Returns: (transfer container) (array length=out_n_coords) (nullable): an
|
||||
* array of time and coordinates
|
||||
*/
|
||||
GdkTimeCoord *
|
||||
gdk_motion_event_get_history (GdkEvent *event,
|
||||
guint *out_n_coords)
|
||||
gdk_event_get_history (GdkEvent *event,
|
||||
guint *out_n_coords)
|
||||
{
|
||||
GdkMotionEvent *self = (GdkMotionEvent *) event;
|
||||
GArray *history;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), NULL);
|
||||
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY), NULL);
|
||||
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY) ||
|
||||
GDK_IS_EVENT_TYPE (event, GDK_SCROLL), NULL);
|
||||
g_return_val_if_fail (out_n_coords != NULL, NULL);
|
||||
|
||||
if (self->history &&
|
||||
self->history->len > 0)
|
||||
if (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY))
|
||||
{
|
||||
GdkMotionEvent *self = (GdkMotionEvent *) event;
|
||||
history = self->history;
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkScrollEvent *self = (GdkScrollEvent *) event;
|
||||
history = self->history;
|
||||
}
|
||||
|
||||
if (history && history->len > 0)
|
||||
{
|
||||
GdkTimeCoord *result;
|
||||
|
||||
*out_n_coords = self->history->len;
|
||||
*out_n_coords = history->len;
|
||||
|
||||
result = g_malloc (sizeof (GdkTimeCoord) * self->history->len);
|
||||
memcpy (result, self->history->data, sizeof (GdkTimeCoord) * self->history->len);
|
||||
result = g_malloc (sizeof (GdkTimeCoord) * history->len);
|
||||
memcpy (result, history->data, sizeof (GdkTimeCoord) * history->len);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+4
-3
@@ -378,6 +378,9 @@ gboolean gdk_event_get_axis (GdkEvent *event,
|
||||
GdkAxisUse axis_use,
|
||||
double *value);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkTimeCoord * gdk_event_get_history (GdkEvent *event,
|
||||
guint *out_n_coords);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -392,6 +395,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_scroll_event_get_deltas (GdkEvent *event,
|
||||
double *delta_x,
|
||||
double *delta_y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -470,9 +474,6 @@ gboolean gdk_grab_broken_event_get_implicit (GdkEvent *event)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_motion_event_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkTimeCoord * gdk_motion_event_get_history (GdkEvent *event,
|
||||
guint *out_n_coords);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_delete_event_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@@ -211,6 +211,9 @@ struct _GdkTouchEvent
|
||||
* @pointer_emulated: whether the scroll event was the result of
|
||||
* a pointer emulation
|
||||
* @tool: a #GdkDeviceTool
|
||||
* @history: (element-type GdkScrollHistory): array of times and deltas
|
||||
* for other scroll events that were compressed before delivering the
|
||||
* current event
|
||||
*
|
||||
* Generated from button presses for the buttons 4 to 7. Wheel mice are
|
||||
* usually configured to generate button press events for buttons 4 and 5
|
||||
@@ -232,6 +235,7 @@ struct _GdkScrollEvent
|
||||
gboolean pointer_emulated;
|
||||
gboolean is_stop;
|
||||
GdkDeviceTool *tool;
|
||||
GArray *history; /* <GdkScrollHistory> */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -123,6 +123,7 @@ GList* _gdk_event_queue_append (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
|
||||
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
|
||||
@@ -2366,6 +2366,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
* candidate it queues up flushing the event queue.
|
||||
*/
|
||||
_gdk_event_queue_handle_motion_compression (display);
|
||||
gdk_event_queue_handle_scroll_compression (display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -247,6 +247,8 @@ typedef enum {
|
||||
* @GDK_AXIS_IGNORE: the axis is ignored.
|
||||
* @GDK_AXIS_X: the axis is used as the x axis.
|
||||
* @GDK_AXIS_Y: the axis is used as the y axis.
|
||||
* @GDK_AXIS_DELTA_X: the axis is used as the scroll x delta
|
||||
* @GDK_AXIS_DELTA_Y: the axis is used as the scroll y delta
|
||||
* @GDK_AXIS_PRESSURE: the axis is used for pressure information.
|
||||
* @GDK_AXIS_XTILT: the axis is used for x tilt information.
|
||||
* @GDK_AXIS_YTILT: the axis is used for y tilt information.
|
||||
@@ -269,6 +271,8 @@ typedef enum
|
||||
GDK_AXIS_IGNORE,
|
||||
GDK_AXIS_X,
|
||||
GDK_AXIS_Y,
|
||||
GDK_AXIS_DELTA_X,
|
||||
GDK_AXIS_DELTA_Y,
|
||||
GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_XTILT,
|
||||
GDK_AXIS_YTILT,
|
||||
@@ -283,6 +287,8 @@ typedef enum
|
||||
* GdkAxisFlags:
|
||||
* @GDK_AXIS_FLAG_X: X axis is present
|
||||
* @GDK_AXIS_FLAG_Y: Y axis is present
|
||||
* @GDK_AXIS_FLAG_DELTA_X: Scroll X delta axis is present
|
||||
* @GDK_AXIS_FLAG_DELTA_Y: Scroll Y delta axis is present
|
||||
* @GDK_AXIS_FLAG_PRESSURE: Pressure axis is present
|
||||
* @GDK_AXIS_FLAG_XTILT: X tilt axis is present
|
||||
* @GDK_AXIS_FLAG_YTILT: Y tilt axis is present
|
||||
@@ -297,6 +303,8 @@ typedef enum
|
||||
{
|
||||
GDK_AXIS_FLAG_X = 1 << GDK_AXIS_X,
|
||||
GDK_AXIS_FLAG_Y = 1 << GDK_AXIS_Y,
|
||||
GDK_AXIS_FLAG_DELTA_X = 1 << GDK_AXIS_DELTA_X,
|
||||
GDK_AXIS_FLAG_DELTA_Y = 1 << GDK_AXIS_DELTA_Y,
|
||||
GDK_AXIS_FLAG_PRESSURE = 1 << GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_FLAG_XTILT = 1 << GDK_AXIS_XTILT,
|
||||
GDK_AXIS_FLAG_YTILT = 1 << GDK_AXIS_YTILT,
|
||||
|
||||
@@ -832,8 +832,8 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
|
||||
|
||||
device = GDK_DEVICE (device_core);
|
||||
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -3386,42 +3386,42 @@ gdk_wayland_device_tablet_clone_tool_axes (GdkWaylandTabletData *tablet,
|
||||
g_object_freeze_notify (G_OBJECT (tablet->current_device));
|
||||
_gdk_device_reset_axes (tablet->current_device);
|
||||
|
||||
_gdk_device_add_axis (tablet->current_device, NULL, GDK_AXIS_X, 0, 0, 0);
|
||||
_gdk_device_add_axis (tablet->current_device, NULL, GDK_AXIS_Y, 0, 0, 0);
|
||||
_gdk_device_add_axis (tablet->current_device, GDK_AXIS_X, 0, 0, 0);
|
||||
_gdk_device_add_axis (tablet->current_device, GDK_AXIS_Y, 0, 0, 0);
|
||||
|
||||
if (tool->tool_axes & (GDK_AXIS_FLAG_XTILT | GDK_AXIS_FLAG_YTILT))
|
||||
{
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_XTILT, -90, 90, 0);
|
||||
tablet->axis_indices[GDK_AXIS_XTILT] = axis_pos;
|
||||
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_YTILT, -90, 90, 0);
|
||||
tablet->axis_indices[GDK_AXIS_YTILT] = axis_pos;
|
||||
}
|
||||
if (tool->tool_axes & GDK_AXIS_FLAG_DISTANCE)
|
||||
{
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_DISTANCE, 0, 65535, 0);
|
||||
tablet->axis_indices[GDK_AXIS_DISTANCE] = axis_pos;
|
||||
}
|
||||
if (tool->tool_axes & GDK_AXIS_FLAG_PRESSURE)
|
||||
{
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_PRESSURE, 0, 65535, 0);
|
||||
tablet->axis_indices[GDK_AXIS_PRESSURE] = axis_pos;
|
||||
}
|
||||
|
||||
if (tool->tool_axes & GDK_AXIS_FLAG_ROTATION)
|
||||
{
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_ROTATION, 0, 360, 0);
|
||||
tablet->axis_indices[GDK_AXIS_ROTATION] = axis_pos;
|
||||
}
|
||||
|
||||
if (tool->tool_axes & GDK_AXIS_FLAG_SLIDER)
|
||||
{
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL,
|
||||
axis_pos = _gdk_device_add_axis (tablet->current_device,
|
||||
GDK_AXIS_SLIDER, -65535, 65535, 0);
|
||||
tablet->axis_indices[GDK_AXIS_SLIDER] = axis_pos;
|
||||
}
|
||||
@@ -3440,7 +3440,6 @@ gdk_wayland_mimic_device_axes (GdkDevice *master,
|
||||
GdkDevice *slave)
|
||||
{
|
||||
gdouble axis_min, axis_max, axis_resolution;
|
||||
const char *axis_label;
|
||||
GdkAxisUse axis_use;
|
||||
gint axis_count;
|
||||
gint i;
|
||||
@@ -3451,9 +3450,9 @@ gdk_wayland_mimic_device_axes (GdkDevice *master,
|
||||
|
||||
for (i = 0; i < axis_count; i++)
|
||||
{
|
||||
_gdk_device_get_axis_info (slave, i, &axis_label, &axis_use, &axis_min,
|
||||
_gdk_device_get_axis_info (slave, i, &axis_use, &axis_min,
|
||||
&axis_max, &axis_resolution);
|
||||
_gdk_device_add_axis (master, axis_label, axis_use, axis_min,
|
||||
_gdk_device_add_axis (master, axis_use, axis_min,
|
||||
axis_max, axis_resolution);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,10 @@ G_DEFINE_TYPE (GdkDeviceVirtual, gdk_device_virtual, GDK_TYPE_DEVICE)
|
||||
|
||||
void
|
||||
_gdk_device_virtual_set_active (GdkDevice *device,
|
||||
GdkDevice *new_active)
|
||||
GdkDevice *new_active)
|
||||
{
|
||||
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
|
||||
int n_axes, i;
|
||||
const char *label_atom;
|
||||
GdkAxisUse use;
|
||||
gdouble min_value, max_value, resolution;
|
||||
|
||||
@@ -50,14 +49,11 @@ _gdk_device_virtual_set_active (GdkDevice *device,
|
||||
_gdk_device_reset_axes (device);
|
||||
n_axes = gdk_device_get_n_axes (new_active);
|
||||
for (i = 0; i < n_axes; i++)
|
||||
{
|
||||
_gdk_device_get_axis_info (new_active, i,
|
||||
&label_atom, &use,
|
||||
&min_value, &max_value, &resolution);
|
||||
_gdk_device_add_axis (device,
|
||||
label_atom, use,
|
||||
min_value, max_value, resolution);
|
||||
}
|
||||
{
|
||||
_gdk_device_get_axis_info (new_active, i, &use,
|
||||
&min_value, &max_value, &resolution);
|
||||
_gdk_device_add_axis (device, use, min_value, max_value, resolution);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
||||
|
||||
@@ -239,6 +239,6 @@ gdk_device_win32_init (GdkDeviceWin32 *device_win32)
|
||||
|
||||
device = GDK_DEVICE (device_win32);
|
||||
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
|
||||
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
|
||||
}
|
||||
|
||||
@@ -577,7 +577,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
if (device->pktdata & PK_X)
|
||||
{
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
NULL,
|
||||
GDK_AXIS_X,
|
||||
axis_x.axMin,
|
||||
axis_x.axMax,
|
||||
@@ -588,7 +587,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
if (device->pktdata & PK_Y)
|
||||
{
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
NULL,
|
||||
GDK_AXIS_Y,
|
||||
axis_y.axMin,
|
||||
axis_y.axMax,
|
||||
@@ -600,7 +598,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
if (device->pktdata & PK_NORMAL_PRESSURE)
|
||||
{
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
NULL,
|
||||
GDK_AXIS_PRESSURE,
|
||||
axis_npressure.axMin,
|
||||
axis_npressure.axMax,
|
||||
@@ -617,14 +614,12 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
* we convert to x and y tilt in the -1000..1000 range
|
||||
*/
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
NULL,
|
||||
GDK_AXIS_XTILT,
|
||||
-1000,
|
||||
1000,
|
||||
1000);
|
||||
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
NULL,
|
||||
GDK_AXIS_YTILT,
|
||||
-1000,
|
||||
1000,
|
||||
|
||||
@@ -211,7 +211,6 @@ translate_valuator_class (GdkDisplay *display,
|
||||
static gboolean initialized = FALSE;
|
||||
static Atom label_atoms [GDK_AXIS_LAST] = { 0 };
|
||||
GdkAxisUse use = GDK_AXIS_IGNORE;
|
||||
const char *label;
|
||||
gint i;
|
||||
|
||||
if (!initialized)
|
||||
@@ -234,13 +233,18 @@ translate_valuator_class (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
if (valuator_label != None)
|
||||
label = gdk_x11_get_xatom_name_for_display (display, valuator_label);
|
||||
else
|
||||
label = NULL;
|
||||
_gdk_device_add_axis (device, use, min, max, resolution);
|
||||
GDK_DISPLAY_NOTE (display, INPUT,
|
||||
{
|
||||
const char *label;
|
||||
|
||||
_gdk_device_add_axis (device, label, use, min, max, resolution);
|
||||
GDK_DISPLAY_NOTE (display, INPUT, g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"));
|
||||
if (valuator_label != None)
|
||||
label = gdk_x11_get_xatom_name_for_display (display, valuator_label);
|
||||
else
|
||||
label = NULL;
|
||||
|
||||
g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)");
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -261,13 +265,7 @@ translate_device_classes (GdkDisplay *display,
|
||||
{
|
||||
case XIKeyClass:
|
||||
{
|
||||
XIKeyClassInfo *key_info = (XIKeyClassInfo *) class_info;
|
||||
gint j;
|
||||
|
||||
_gdk_device_set_keys (device, key_info->num_keycodes);
|
||||
|
||||
for (j = 0; j < key_info->num_keycodes; j++)
|
||||
gdk_device_set_key (device, j, key_info->keycodes[j], 0);
|
||||
/* Not used */
|
||||
}
|
||||
break;
|
||||
case XIValuatorClass:
|
||||
|
||||
@@ -489,6 +489,7 @@ gtk_file_chooser_native_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case GTK_FILE_CHOOSER_PROP_FILTER:
|
||||
self->current_filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (self->dialog));
|
||||
g_value_set_object (value, self->current_filter);
|
||||
break;
|
||||
|
||||
|
||||
@@ -278,8 +278,8 @@ gtk_gesture_stylus_get_axes (GtkGestureStylus *gesture,
|
||||
**/
|
||||
gboolean
|
||||
gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
GdkTimeCoord **backlog,
|
||||
guint *n_elems)
|
||||
GdkTimeCoord **backlog,
|
||||
guint *n_elems)
|
||||
{
|
||||
GdkEvent *event;
|
||||
GArray *backlog_array;
|
||||
@@ -292,7 +292,7 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
event = gesture_get_current_event (gesture);
|
||||
|
||||
if (event && GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY))
|
||||
history = gdk_motion_event_get_history (event, &n_coords);
|
||||
history = gdk_event_get_history (event, &n_coords);
|
||||
|
||||
if (!history)
|
||||
return FALSE;
|
||||
|
||||
@@ -94,15 +94,15 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
|
||||
goto out;
|
||||
|
||||
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
|
||||
phase = gdk_touchpad_event_get_gesture_phase (last_event);
|
||||
|
||||
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
|
||||
(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
|
||||
phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
|
||||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
|
||||
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH)
|
||||
{
|
||||
double scale;
|
||||
|
||||
/* Touchpad pinch */
|
||||
phase = gdk_touchpad_event_get_gesture_phase (last_event);
|
||||
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
||||
goto out;
|
||||
|
||||
scale = gdk_touchpad_event_get_pinch_scale (last_event);
|
||||
*distance = scale;
|
||||
|
||||
+1
-21
@@ -81,7 +81,6 @@ gtk_icon_cache_new_for_path (const gchar *path)
|
||||
GMappedFile *map;
|
||||
|
||||
gchar *cache_filename;
|
||||
gint fd = -1;
|
||||
GStatBuf st;
|
||||
GStatBuf path_st;
|
||||
|
||||
@@ -93,24 +92,7 @@ gtk_icon_cache_new_for_path (const gchar *path)
|
||||
if (g_stat (path, &path_st) < 0)
|
||||
goto done;
|
||||
|
||||
/* Open the file and map it into memory */
|
||||
fd = g_open (cache_filename, O_RDONLY|_O_BINARY, 0);
|
||||
|
||||
if (fd < 0)
|
||||
goto done;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
/* Bug 660730: _fstat32 is only defined in msvcrt80.dll+/VS 2005+ */
|
||||
/* or possibly in the msvcrt.dll linked to by the Windows DDK */
|
||||
/* (will need to check on the Windows DDK part later) */
|
||||
#if ((defined (_MSC_VER) && (_MSC_VER >= 1400 || __MSVCRT_VERSION__ >= 0x0800)) || defined (__MINGW64_VERSION_MAJOR)) && !defined(_WIN64)
|
||||
#undef fstat /* Just in case */
|
||||
#define fstat _fstat32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (fstat (fd, &st) < 0 || st.st_size < 4)
|
||||
if (g_stat (cache_filename, &st) < 0 || st.st_size < 4)
|
||||
goto done;
|
||||
|
||||
/* Verify cache is uptodate */
|
||||
@@ -154,8 +136,6 @@ gtk_icon_cache_new_for_path (const gchar *path)
|
||||
|
||||
done:
|
||||
g_free (cache_filename);
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
+64
-1
@@ -46,6 +46,7 @@ struct _GtkSearchEnginePrivate {
|
||||
GHashTable *hits;
|
||||
|
||||
GtkQuery *query;
|
||||
GSequence *items;
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -58,7 +59,46 @@ enum
|
||||
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkSearchEngine, _gtk_search_engine, G_TYPE_OBJECT);
|
||||
static GType
|
||||
gtk_search_engine_get_item_type (GListModel *list)
|
||||
{
|
||||
return G_TYPE_FILE_INFO;
|
||||
}
|
||||
|
||||
static guint
|
||||
gtk_search_engine_get_n_items (GListModel *list)
|
||||
{
|
||||
GtkSearchEngine *self = GTK_SEARCH_ENGINE (list);
|
||||
|
||||
return g_sequence_get_length (self->priv->items);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
gtk_search_engine_get_item (GListModel *list,
|
||||
guint position)
|
||||
{
|
||||
GtkSearchEngine *self = GTK_SEARCH_ENGINE (list);
|
||||
GSequenceIter *iter;
|
||||
|
||||
iter = g_sequence_get_iter_at_pos (self->priv->items, position);
|
||||
|
||||
if (g_sequence_iter_is_end (iter))
|
||||
return NULL;
|
||||
else
|
||||
return g_object_ref (g_sequence_get (iter));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_engine_list_model_init (GListModelInterface *iface)
|
||||
{
|
||||
iface->get_item_type = gtk_search_engine_get_item_type;
|
||||
iface->get_n_items = gtk_search_engine_get_n_items;
|
||||
iface->get_item = gtk_search_engine_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkSearchEngine, _gtk_search_engine, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (GtkSearchEngine)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_search_engine_list_model_init))
|
||||
|
||||
static void
|
||||
set_query (GtkSearchEngine *engine,
|
||||
@@ -73,9 +113,25 @@ set_query (GtkSearchEngine *engine,
|
||||
_gtk_search_engine_set_query (engine->priv->model, query);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_engine_clear_items (GtkSearchEngine *engine)
|
||||
{
|
||||
guint n_items;
|
||||
|
||||
n_items = g_sequence_get_length (engine->priv->items);
|
||||
if (n_items > 0)
|
||||
{
|
||||
g_sequence_remove_range (g_sequence_get_begin_iter (engine->priv->items),
|
||||
g_sequence_get_end_iter (engine->priv->items));
|
||||
|
||||
g_list_model_items_changed (G_LIST_MODEL (engine), 0, n_items, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
start (GtkSearchEngine *engine)
|
||||
{
|
||||
gtk_search_engine_clear_items (engine);
|
||||
g_hash_table_remove_all (engine->priv->hits);
|
||||
|
||||
if (engine->priv->native)
|
||||
@@ -112,6 +168,7 @@ stop (GtkSearchEngine *engine)
|
||||
|
||||
engine->priv->running = FALSE;
|
||||
|
||||
gtk_search_engine_clear_items (engine);
|
||||
g_hash_table_remove_all (engine->priv->hits);
|
||||
}
|
||||
|
||||
@@ -127,6 +184,7 @@ finalize (GObject *object)
|
||||
g_free (engine->priv->model_error);
|
||||
|
||||
g_clear_pointer (&engine->priv->hits, g_hash_table_unref);
|
||||
g_clear_pointer (&engine->priv->items, g_sequence_free);
|
||||
|
||||
g_clear_object (&engine->priv->query);
|
||||
|
||||
@@ -201,12 +259,16 @@ hits_added (GtkSearchEngine *engine,
|
||||
{
|
||||
hit = _gtk_search_hit_dup (hit);
|
||||
g_hash_table_add (composite->priv->hits, hit);
|
||||
g_sequence_append (composite->priv->items, g_object_ref (hit->info));
|
||||
added = g_list_prepend (added, hit);
|
||||
}
|
||||
}
|
||||
|
||||
if (added)
|
||||
{
|
||||
guint n = g_list_length (added);
|
||||
g_list_model_items_changed (G_LIST_MODEL (composite), g_sequence_get_length (composite->priv->items) - n, 0, n);
|
||||
|
||||
_gtk_search_engine_hits_added (composite, added);
|
||||
g_list_free (added);
|
||||
}
|
||||
@@ -353,6 +415,7 @@ _gtk_search_engine_new (void)
|
||||
|
||||
engine->priv->hits = g_hash_table_new_full (search_hit_hash, search_hit_equal,
|
||||
(GDestroyNotify)_gtk_search_hit_free, NULL);
|
||||
engine->priv->items = g_sequence_new (g_object_unref);
|
||||
|
||||
return engine;
|
||||
}
|
||||
|
||||
+2
-10
@@ -37,7 +37,7 @@ wayland_proto_req = '>= 1.20'
|
||||
wayland_req = '>= 1.14.91'
|
||||
graphene_req = '>= 1.9.1'
|
||||
epoxy_req = '>= 1.4'
|
||||
cloudproviders_req = '>= 0.3.1'
|
||||
cloudproviders_req = '>= 0.2.5'
|
||||
xkbcommon_req = '>= 0.2.0'
|
||||
|
||||
gnome = import('gnome')
|
||||
@@ -666,15 +666,7 @@ endif
|
||||
|
||||
cloudproviders_enabled = get_option('cloudproviders')
|
||||
if cloudproviders_enabled
|
||||
cloudproviders_dep = dependency('cloudproviders',
|
||||
version: cloudproviders_req,
|
||||
fallback: [
|
||||
'libcloudproviders',
|
||||
'libcloudproviders_dep',
|
||||
],
|
||||
default_options: [
|
||||
'vapigen=false',
|
||||
])
|
||||
cloudproviders_dep = dependency('cloudproviders', required: true)
|
||||
if cloudproviders_dep.found()
|
||||
cdata.set('HAVE_CLOUDPROVIDERS', cloudproviders_dep.found())
|
||||
else
|
||||
|
||||
+209
-262
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
[wrap-git]
|
||||
directory=libcloudproviders
|
||||
url=https://gitlab.gnome.org/World/libcloudproviders.git
|
||||
revision=master
|
||||
Reference in New Issue
Block a user