Compare commits

...

7 Commits

Author SHA1 Message Date
Matthias Clasen
7cd7e781e2 text: Ignore synthetic motion events
We want to re-show the obscured mouse cursor when the
user interacts with the mouse, not when the pointer position
relative to the widget changed. So, ignore synthetic
motion events.

Fixes: #3792
2021-03-25 15:25:35 -04:00
Matthias Clasen
7aed044cb6 surface: Mark synthetic motion events as such
This will let us discriminate them from actual
device movement when necessary.
2021-03-25 15:24:47 -04:00
Matthias Clasen
e1fde3e2cd Add private api for synthetic events
Add a function to create motion events and mark them
as synthetic.
2021-03-25 15:24:18 -04:00
Matthias Clasen
bef9b9ccc6 Typo fix 2021-03-25 13:53:56 -04:00
Matthias Clasen
a05efd7270 treelistmodel: Add some docs 2021-03-25 13:53:44 -04:00
Matthias Clasen
ec235fa353 ngl: Reword a warning 2021-03-25 08:02:05 -04:00
Matthias Clasen
eb18e4d9b0 Updates 2021-03-25 07:44:58 -04:00
9 changed files with 107 additions and 10 deletions

39
NEWS
View File

@@ -1,3 +1,42 @@
Overview of Changes in 4.2.0
============================
* Label: Fix tooltips on links
* X11:
- Fix damage handling
- Trap errors from the COW
* Windows: Use a visible scroll cursor
* Wayland: Fix key event matching with mismatched layouts.
This was causing keyboard accelerators to trigger unexpectedly
* Inspector: Allow inspecting Unicode
* Input:
- Improve dead key handling
- Regenerate compose sequence table
* gsk:
- Fix a crash in the ngl renderer
- Fix a rounding error in subpixel glyph positioning
- ngl: Implement glyph cache eviction
- ngl: Improve the glyph cache effectiveness
- ngl: Fix uniform key mapping on Windows
- Make the ngl renderer the default
* build:
- Fix build with cairo as subproject
- Disable g_assert in release builds
* Translation updates:
Hungarian
Italian
Polish
Ukrainian
Overview of Changes in 4.1.2
============================

View File

@@ -2894,6 +2894,31 @@ gdk_motion_event_new (GdkSurface *surface,
return (GdkEvent *) self;
}
GdkEvent *
gdk_synthetic_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
double x,
double y,
double *axes)
{
GdkEvent *event;
event = gdk_motion_event_new (surface, device, tool, time, state, x, y, axes);
event->flags |= GDK_EVENT_SYNTHETIC;
return event;
}
gboolean
gdk_motion_event_is_synthetic (GdkEvent *event)
{
return (event->flags & GDK_EVENT_SYNTHETIC) != 0;
}
/**
* gdk_event_get_history:
* @event: a motion or scroll event

View File

@@ -446,6 +446,15 @@ GdkEvent * gdk_motion_event_new (GdkSurface *surface,
double y,
double *axes);
GdkEvent * gdk_synthetic_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
double x,
double y,
double *axes);
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
@@ -576,6 +585,8 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
gboolean no_lock);
gboolean gdk_motion_event_is_synthetic (GdkEvent *event);
typedef enum
{
/* Following flag is set for events on the event queue during
@@ -587,7 +598,10 @@ typedef enum
* mark all events in the queue with this flag, and deliver
* only those events until we finish the frame.
*/
GDK_EVENT_FLUSHED = 1 << 2
GDK_EVENT_FLUSHED = 1 << 1,
/* Used for synthetic motion events. */
GDK_EVENT_SYNTHETIC = 1 << 2,
} GdkEventFlags;
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);

View File

@@ -2455,13 +2455,13 @@ gdk_surface_ensure_motion (GdkSurface *surface)
if (!gdk_surface_get_device_position (surface, device, &x, &y, &state))
return;
event = gdk_motion_event_new (surface,
device,
NULL,
GDK_CURRENT_TIME,
state,
x, y,
NULL);
event = gdk_synthetic_motion_event_new (surface,
device,
NULL,
GDK_CURRENT_TIME,
state,
x, y,
NULL);
gdk_surface_handle_event (event);
gdk_event_unref (event);

View File

@@ -204,7 +204,7 @@ gsk_ngl_texture_library_pack_one (GskNglTextureLibrary *self,
if (width > self->driver->command_queue->max_texture_size ||
height > self->driver->command_queue->max_texture_size)
{
g_warning ("Clipping requested texture of size %ux%u to maximum allowable size %u.",
g_warning ("Texture bigger (%ux%u) than the aximum allowable size %u.",
width, height, self->driver->command_queue->max_texture_size);
width = MIN (width, self->driver->command_queue->max_texture_size);
height = MIN (height, self->driver->command_queue->max_texture_size);

View File

@@ -2940,6 +2940,11 @@ gtk_text_motion_controller_motion (GtkEventControllerMotion *controller,
GtkText *self)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
GdkEvent *event;
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (controller));
if (gdk_motion_event_is_synthetic (event))
return;
if (priv->mouse_cursor_obscured)
{

View File

@@ -5712,6 +5712,12 @@ gtk_text_view_motion (GtkEventController *controller,
double y,
gpointer user_data)
{
GdkEvent *event;
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (controller));
if (gdk_motion_event_is_synthetic (event))
return;
gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (user_data));
}

View File

@@ -29,6 +29,14 @@
* GtkTreeListModel:
*
* `GtkTreeListModel` is a list model that can create child models on demand.
*
* `GtkTreeListModel` is typically used together with `GtkTreeExpander` to
* make list widgets where user can expand rows by clicking on an expander.
*
* When creating `GtkTreeListModel` with [ctor@Gtk.TreeListModel.new], you
* specify a *root* model that contains the initial items for your tree, and
* a callback function that we be called whenever the tree model needs to
* find the children of a given item.
*/
enum {

View File

@@ -2046,7 +2046,7 @@ gtk_window_native_layout (GtkNative *native,
}
/* This fake motion event is needed for getting up to date pointer focus
* and coordinates when tho pointer didn't move but the layout changed
* and coordinates when the pointer didn't move but the layout changed
* within the window.
*/
if (gtk_widget_needs_allocate (widget))