gdk_surface_get_children
gdk_surface_get_children_with_user_data
gdk_surface_peek_children
-gdk_surface_get_events
-gdk_surface_set_events
gdk_surface_set_icon_name
gdk_surface_set_transient_for
gdk_surface_set_role
gdk_surface_set_support_multidevice
gdk_surface_get_device_cursor
gdk_surface_set_device_cursor
-gdk_surface_get_device_events
-gdk_surface_set_device_events
<SUBSECTION>
gdk_surface_coords_from_parent
</para>
</refsect2>
- <refsect2 id="event-masks">
- <title>Event masks</title>
-
- <para>
- Each widget instance has a basic event mask and another per input device,
- which determine the types of input event it receives. Each event mask set
- on a widget is added to the corresponding (basic or per-device) event mask
- for the widget’s #GdkSurface, and all child #GdkSurfaces.
- </para>
-
- <para>
- Filtering events against event masks happens inside #GdkSurface, which
- exposes event masks to the windowing system to reduce the number of events
- GDK receives from it. On receiving an event, it is filtered against the
- #GdkSurface’s mask for the input device, if set. Otherwise, it is filtered
- against the #GdkSurface’s basic event mask.
- </para>
-
- <para>
- This means that widgets must add to the event mask for each event type
- they expect to receive, using gtk_widget_set_events() or
- gtk_widget_add_events() to preserve the existing mask. Widgets which are
- aware of floating devices should use gtk_widget_set_device_events() or
- gtk_widget_add_device_events(), and must explicitly enable the device
- using gtk_widget_set_device_enabled(). See the #GdkDeviceManager
- documentation for more information.
- </para>
-
- <para>
- All standard widgets set the event mask for all events they expect to
- receive, and it is not necessary to modify this. Masks should be set when
- implementing a new widget.
- </para>
- </refsect2>
-
<refsect2>
<title>Touch events</title>
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
-static void gdk_broadway_device_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask);
G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE)
device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab;
device_class->surface_at_position = gdk_broadway_device_surface_at_position;
- device_class->select_surface_events = gdk_broadway_device_select_surface_events;
}
static void
return surface;
}
-static void
-gdk_broadway_device_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask)
-{
-}
void _gdk_broadway_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
gint _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
_gdk_broadway_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
{
GdkSurfaceImplBroadway *impl;
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = TRUE;
- if (surface->event_mask & GDK_STRUCTURE_MASK)
- _gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
+ _gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
- if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
+ if (surface->parent)
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = FALSE;
- if (surface->event_mask & GDK_STRUCTURE_MASK)
- _gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
+ _gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
- if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
+ if (surface->parent)
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
return child != NULL;
}
-static GdkEventMask
-gdk_surface_broadway_get_events (GdkSurface *surface)
-{
- if (GDK_SURFACE_DESTROYED (surface))
- return 0;
-
- return 0;
-}
-
-static void
-gdk_surface_broadway_set_events (GdkSurface *surface,
- GdkEventMask event_mask)
-{
- if (!GDK_SURFACE_DESTROYED (surface))
- {
- }
-}
-
static void
gdk_surface_broadway_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
impl_class->show = gdk_surface_broadway_show;
impl_class->hide = gdk_surface_broadway_hide;
impl_class->withdraw = gdk_surface_broadway_withdraw;
- impl_class->set_events = gdk_surface_broadway_set_events;
- impl_class->get_events = gdk_surface_broadway_get_events;
impl_class->raise = gdk_surface_broadway_raise;
impl_class->lower = gdk_surface_broadway_lower;
impl_class->restack_toplevel = gdk_surface_broadway_restack_toplevel;
double *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
- void (* select_surface_events) (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask);
};
void _gdk_device_set_associated_device (GdkDevice *device,
}
void
-_gdk_display_create_surface_impl (GdkDisplay *display,
- GdkSurface *surface,
- GdkSurface *real_parent,
- GdkEventMask event_mask,
- GdkSurfaceAttr *attributes)
+gdk_display_create_surface_impl (GdkDisplay *display,
+ GdkSurface *surface,
+ GdkSurface *real_parent,
+ GdkSurfaceAttr *attributes)
{
GDK_DISPLAY_GET_CLASS (display)->create_surface_impl (display,
- surface,
- real_parent,
- event_mask,
- attributes);
+ surface,
+ real_parent,
+ attributes);
}
GdkSurface *
void (*create_surface_impl) (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GdkKeymap * (*get_keymap) (GdkDisplay *display);
GdkEvent *new_event);
void _gdk_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
-void _gdk_display_create_surface_impl (GdkDisplay *display,
+void gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GdkSurface * _gdk_display_create_surface (GdkDisplay *display);
gint x;
gint y;
- GdkEventMask event_mask;
guint8 surface_type;
guint8 resize_count;
cairo_region_t *input_shape;
GList *devices_inside;
- GHashTable *device_events;
GdkFrameClock *frame_clock; /* NULL to use from parent or default */
surface->devices_inside = g_list_remove (surface->devices_inside, device);
g_hash_table_remove (surface->device_cursor, device);
-
- if (surface->device_events)
- g_hash_table_remove (surface->device_events, device);
}
static void
if (surface->device_cursor)
g_hash_table_destroy (surface->device_cursor);
- if (surface->device_events)
- g_hash_table_destroy (surface->device_events);
-
if (surface->devices_inside)
g_list_free (surface->devices_inside);
recompute_visible_regions (surface, FALSE);
}
-static GdkEventMask
-get_native_device_event_mask (GdkSurface *private,
- GdkDevice *device)
-{
- GdkEventMask event_mask;
-
- if (device)
- event_mask = GPOINTER_TO_INT (g_hash_table_lookup (private->device_events, device));
- else
- event_mask = private->event_mask;
-
- if (private->surface_type == GDK_SURFACE_FOREIGN)
- return event_mask;
- else
- {
- GdkEventMask mask;
-
- mask = private->event_mask;
-
- /* We need thse for all native surfaces so we can
- emulate events on children: */
- mask |=
- GDK_EXPOSURE_MASK |
- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
- GDK_TOUCH_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_SCROLL_MASK;
-
- return mask;
- }
-}
-
-static GdkEventMask
-get_native_event_mask (GdkSurface *private)
-{
- return get_native_device_event_mask (private, NULL);
-}
-
GdkSurface*
gdk_surface_new (GdkDisplay *display,
GdkSurface *parent,
{
GdkSurface *surface;
gboolean native;
- GdkEventMask event_mask;
g_return_val_if_fail (attributes != NULL, NULL);
return NULL;
}
- surface->event_mask = GDK_ALL_EVENTS_MASK;
-
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
surface->input_only = FALSE;
if (native)
{
- event_mask = get_native_event_mask (surface);
-
/* Create the impl */
- _gdk_display_create_surface_impl (display, surface, parent, event_mask, attributes);
+ gdk_display_create_surface_impl (display, surface, parent, attributes);
surface->impl_surface = surface;
}
else
if (!was_mapped && !gdk_surface_has_impl (surface))
{
- if (surface->event_mask & GDK_STRUCTURE_MASK)
- _gdk_make_event (surface, GDK_MAP, NULL, FALSE);
+ _gdk_make_event (surface, GDK_MAP, NULL, FALSE);
- if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
+ if (surface->parent)
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
}
if (was_mapped && !gdk_surface_has_impl (surface))
{
- if (surface->event_mask & GDK_STRUCTURE_MASK)
- _gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
+ _gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
- if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
+ if (surface->parent)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
if (was_mapped)
{
- if (surface->event_mask & GDK_STRUCTURE_MASK)
- _gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
+ _gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
- if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
+ if (surface->parent)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
}
}
-/**
- * gdk_surface_set_events:
- * @surface: a #GdkSurface
- * @event_mask: event mask for @surface
- *
- * The event mask for a surface determines which events will be reported
- * for that surface from all master input devices. For example, an event mask
- * including #GDK_BUTTON_PRESS_MASK means the surface should report button
- * press events. The event mask is the bitwise OR of values from the
- * #GdkEventMask enumeration.
- *
- * See the [input handling overview][event-masks] for details.
- **/
-void
-gdk_surface_set_events (GdkSurface *surface,
- GdkEventMask event_mask)
-{
- GdkSurfaceImplClass *impl_class;
-
- g_return_if_fail (GDK_IS_SURFACE (surface));
-
- if (surface->destroyed)
- return;
-
- surface->event_mask = event_mask;
-
- if (gdk_surface_has_impl (surface))
- {
- impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
- impl_class->set_events (surface,
- get_native_event_mask (surface));
- }
-
-}
-
-/**
- * gdk_surface_get_events:
- * @surface: a #GdkSurface
- *
- * Gets the event mask for @surface for all master input devices. See
- * gdk_surface_set_events().
- *
- * Returns: event mask for @surface
- **/
-GdkEventMask
-gdk_surface_get_events (GdkSurface *surface)
-{
- g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
-
- if (surface->destroyed)
- return 0;
-
- return surface->event_mask;
-}
-
-/**
- * gdk_surface_set_device_events:
- * @surface: a #GdkSurface
- * @device: #GdkDevice to enable events for.
- * @event_mask: event mask for @surface
- *
- * Sets the event mask for a given device (Normally a floating device, not
- * attached to any visible pointer) to @surface. For example, an event mask
- * including #GDK_BUTTON_PRESS_MASK means the surface should report button
- * press events. The event mask is the bitwise OR of values from the
- * #GdkEventMask enumeration.
- *
- * See the [input handling overview][event-masks] for details.
- **/
-void
-gdk_surface_set_device_events (GdkSurface *surface,
- GdkDevice *device,
- GdkEventMask event_mask)
-{
- GdkEventMask device_mask;
- GdkSurface *native;
-
- g_return_if_fail (GDK_IS_SURFACE (surface));
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- if (GDK_SURFACE_DESTROYED (surface))
- return;
-
- if (G_UNLIKELY (!surface->device_events))
- surface->device_events = g_hash_table_new (NULL, NULL);
-
- if (event_mask == 0)
- {
- /* FIXME: unsetting events on a master device
- * would restore surface->event_mask
- */
- g_hash_table_remove (surface->device_events, device);
- }
- else
- g_hash_table_insert (surface->device_events, device,
- GINT_TO_POINTER (event_mask));
-
- native = gdk_surface_get_toplevel (surface);
-
- device_mask = get_native_device_event_mask (surface, device);
- GDK_DEVICE_GET_CLASS (device)->select_surface_events (device, native, device_mask);
-}
-
-/**
- * gdk_surface_get_device_events:
- * @surface: a #GdkSurface.
- * @device: a #GdkDevice.
- *
- * Returns the event mask for @surface corresponding to an specific device.
- *
- * Returns: device event mask for @surface
- **/
-GdkEventMask
-gdk_surface_get_device_events (GdkSurface *surface,
- GdkDevice *device)
-{
- GdkEventMask mask;
-
- g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
- g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
-
- if (GDK_SURFACE_DESTROYED (surface))
- return 0;
-
- if (!surface->device_events)
- return 0;
-
- mask = GPOINTER_TO_INT (g_hash_table_lookup (surface->device_events, device));
-
- /* FIXME: device could be controlled by surface->event_mask */
-
- return mask;
-}
-
static void
gdk_surface_move_resize_toplevel (GdkSurface *surface,
gboolean with_move,
GList * gdk_surface_get_children_with_user_data (GdkSurface *surface,
gpointer user_data);
-GDK_AVAILABLE_IN_ALL
-GdkEventMask gdk_surface_get_events (GdkSurface *surface);
-GDK_AVAILABLE_IN_ALL
-void gdk_surface_set_events (GdkSurface *surface,
- GdkEventMask event_mask);
-GDK_AVAILABLE_IN_ALL
-void gdk_surface_set_device_events (GdkSurface *surface,
- GdkDevice *device,
- GdkEventMask event_mask);
-GDK_AVAILABLE_IN_ALL
-GdkEventMask gdk_surface_get_device_events (GdkSurface *surface,
- GdkDevice *device);
-
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_icon_list (GdkSurface *surface,
GList *surfaces);
gint rect_anchor_dx,
gint rect_anchor_dy);
- GdkEventMask (* get_events) (GdkSurface *surface);
- void (* set_events) (GdkSurface *surface,
- GdkEventMask event_mask);
-
void (* get_geometry) (GdkSurface *surface,
gint *x,
gint *y,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
-static void gdk_quartz_device_core_select_surface_events (GdkDevice *device,
- GdkSurface *window,
- GdkEventMask event_mask);
G_DEFINE_TYPE (GdkQuartzDeviceCore, gdk_quartz_device_core, GDK_TYPE_DEVICE)
device_class->grab = gdk_quartz_device_core_grab;
device_class->ungrab = gdk_quartz_device_core_ungrab;
device_class->surface_at_position = gdk_quartz_device_core_surface_at_position;
- device_class->select_surface_events = gdk_quartz_device_core_select_surface_events;
}
static void
return found_window;
}
-static void
-gdk_quartz_device_core_select_surface_events (GdkDevice *device,
- GdkSurface *window,
- GdkEventMask event_mask)
-{
- /* The mask is set in the common code. */
-}
void _gdk_quartz_display_create_surface_impl (GdkDisplay *display,
GdkSurface *window,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
/* Display methods - keymap */
_gdk_quartz_display_create_surface_impl (GdkDisplay *display,
GdkSurface *window,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
{
GdkSurfaceImplQuartz *impl;
x, y, mask) != NULL;
}
-static GdkEventMask
-gdk_surface_quartz_get_events (GdkSurface *window)
-{
- if (GDK_SURFACE_DESTROYED (window))
- return 0;
- else
- return window->event_mask;
-}
-
-static void
-gdk_surface_quartz_set_events (GdkSurface *window,
- GdkEventMask event_mask)
-{
- /* The mask is set in the common code. */
-}
-
static void
gdk_quartz_surface_set_urgency_hint (GdkSurface *window,
gboolean urgent)
impl_class->show = gdk_surface_quartz_show;
impl_class->hide = gdk_surface_quartz_hide;
impl_class->withdraw = gdk_surface_quartz_withdraw;
- impl_class->set_events = gdk_surface_quartz_set_events;
- impl_class->get_events = gdk_surface_quartz_get_events;
impl_class->raise = gdk_surface_quartz_raise;
impl_class->lower = gdk_surface_quartz_lower;
impl_class->restack_toplevel = gdk_surface_quartz_restack_toplevel;
return pointer->focus;
}
-static void
-gdk_wayland_device_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask)
-{
-}
-
static void
gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
{
device_class->grab = gdk_wayland_device_grab;
device_class->ungrab = gdk_wayland_device_ungrab;
device_class->surface_at_position = gdk_wayland_device_surface_at_position;
- device_class->select_surface_events = gdk_wayland_device_select_surface_events;
}
static void
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
_gdk_wayland_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
}
}
-static void
-gdk_surface_wayland_set_events (GdkSurface *surface,
- GdkEventMask event_mask)
-{
- GDK_SURFACE (surface)->event_mask = event_mask;
-}
-
-static GdkEventMask
-gdk_surface_wayland_get_events (GdkSurface *surface)
-{
- if (GDK_SURFACE_DESTROYED (surface))
- return 0;
- else
- return GDK_SURFACE (surface)->event_mask;
-}
-
static void
gdk_surface_wayland_raise (GdkSurface *surface)
{
impl_class->show = gdk_wayland_surface_show;
impl_class->hide = gdk_wayland_surface_hide;
impl_class->withdraw = gdk_surface_wayland_withdraw;
- impl_class->set_events = gdk_surface_wayland_set_events;
- impl_class->get_events = gdk_surface_wayland_get_events;
impl_class->raise = gdk_surface_wayland_raise;
impl_class->lower = gdk_surface_wayland_lower;
impl_class->restack_toplevel = gdk_surface_wayland_restack_toplevel;
_gdk_display_device_grab_update (display, device, device, 0);
}
-static void
-gdk_device_virtual_select_surface_events (GdkDevice *device,
- GdkSurface *window,
- GdkEventMask event_mask)
-{
-}
-
static void
gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
{
device_class->grab = gdk_device_virtual_grab;
device_class->ungrab = gdk_device_virtual_ungrab;
device_class->surface_at_position = _gdk_device_win32_surface_at_position;
- device_class->select_surface_events = gdk_device_virtual_select_surface_events;
}
static void
return window;
}
-static void
-gdk_device_win32_select_surface_events (GdkDevice *device,
- GdkSurface *window,
- GdkEventMask event_mask)
-{
-}
-
static void
gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
{
device_class->grab = gdk_device_win32_grab;
device_class->ungrab = gdk_device_win32_ungrab;
device_class->surface_at_position = _gdk_device_win32_surface_at_position;
- device_class->select_surface_events = gdk_device_win32_select_surface_events;
}
static void
return NULL;
}
-static void
-gdk_device_wintab_select_surface_events (GdkDevice *device,
- GdkSurface *window,
- GdkEventMask event_mask)
-{
-}
-
void
_gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
GdkSurface *window,
device_class->grab = gdk_device_wintab_grab;
device_class->ungrab = gdk_device_wintab_ungrab;
device_class->surface_at_position = gdk_device_wintab_surface_at_position;
- device_class->select_surface_events = gdk_device_wintab_select_surface_events;
}
static void
if (!(translated_buttons & button_mask))
{
event->any.type = GDK_BUTTON_RELEASE;
- masktest = GDK_BUTTON_RELEASE_MASK;
}
else
{
event->any.type = GDK_BUTTON_PRESS;
- masktest = GDK_BUTTON_PRESS_MASK;
}
source_device->button_state ^= button_mask;
}
else
{
event->any.type = GDK_MOTION_NOTIFY;
- masktest = GDK_POINTER_MOTION_MASK;
- if (source_device->button_state & (1 << 0))
- masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK;
- if (source_device->button_state & (1 << 1))
- masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON2_MOTION_MASK;
- if (source_device->button_state & (1 << 2))
- masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON3_MOTION_MASK;
- }
-
- /* Now we can check if the window wants the event, and
- * propagate if necessary.
- */
- while ((gdk_surface_get_device_events (window, GDK_DEVICE (source_device)) & masktest) == 0 &&
- (gdk_device_get_device_type (GDK_DEVICE (source_device)) == GDK_DEVICE_TYPE_SLAVE &&
- (gdk_surface_get_events (window) & masktest) == 0))
- {
- GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
-
- if (window->parent == NULL)
- return FALSE;
-
- impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
- pt.x = x * impl->surface_scale;
- pt.y = y * impl->surface_scale;
- ClientToScreen (GDK_SURFACE_HWND (window), &pt);
- g_object_unref (window);
- window = window->parent;
- impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
- g_object_ref (window);
- ScreenToClient (GDK_SURFACE_HWND (window), &pt);
- x = pt.x / impl->surface_scale;
- y = pt.y / impl->surface_scale;
- GDK_NOTE (EVENTS_OR_INPUT, g_print ("... propagating to %p %+d%+d\n",
- GDK_SURFACE_HWND (window), x, y));
}
event->any.surface = window;
}
}
-/* The check_extended flag controls whether to check if the windows want
- * events from extended input devices and if the message should be skipped
- * because an extended input device is active
- */
-static gboolean
-propagate (GdkSurface **window,
- MSG *msg,
- GdkSurface *grab_window,
- gboolean grab_owner_events,
- gint grab_mask,
- gboolean (*doesnt_want_it) (gint mask,
- MSG *msg))
-{
- if (grab_window != NULL && !grab_owner_events)
- {
- /* Event source is grabbed with owner_events FALSE */
-
- if ((*doesnt_want_it) (grab_mask, msg))
- {
- GDK_NOTE (EVENTS, g_print (" (grabber doesn't want it)"));
- return FALSE;
- }
- else
- {
- GDK_NOTE (EVENTS, g_print (" (to grabber)"));
- g_set_object (window, grab_window);
- return TRUE;
- }
- }
-
- /* If we come here, we know that if grab_window != NULL then
- * grab_owner_events is TRUE
- */
- while (TRUE)
- {
- if ((*doesnt_want_it) ((*window)->event_mask, msg))
- {
- /* Owner doesn't want it, propagate to parent. */
- GdkSurface *parent = gdk_surface_get_parent (*window);
- if (parent == NULL)
- {
- /* No parent; check if grabbed */
- if (grab_window != NULL)
- {
- /* Event source is grabbed with owner_events TRUE */
-
- if ((*doesnt_want_it) (grab_mask, msg))
- {
- /* Grabber doesn't want it either */
- GDK_NOTE (EVENTS, g_print (" (grabber doesn't want it)"));
- return FALSE;
- }
- else
- {
- /* Grabbed! */
- GDK_NOTE (EVENTS, g_print (" (to grabber)"));
- g_set_object (window, grab_window);
- return TRUE;
- }
- }
- else
- {
- GDK_NOTE (EVENTS, g_print (" (undelivered)"));
- return FALSE;
- }
- }
- else
- {
- g_set_object (window, parent);
- /* The only branch where we actually continue the loop */
- }
- }
- else
- return TRUE;
- }
-}
-
-static gboolean
-doesnt_want_key (gint mask,
- MSG *msg)
-{
- return (((msg->message == WM_KEYUP || msg->message == WM_SYSKEYUP) &&
- !(mask & GDK_KEY_RELEASE_MASK)) ||
- ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN) &&
- !(mask & GDK_KEY_PRESS_MASK)));
-}
-
-static gboolean
-doesnt_want_char (gint mask,
- MSG *msg)
-{
- return !(mask & (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK));
-}
-
/* Acquires actual client area size of the underlying native window.
* Rectangle is in GDK screen coordinates (_gdk_offset_* is added).
* Returns FALSE if configure events should be inhibited,
RECT rect)
{
GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+ GdkEvent *event;
impl->unscaled_width = rect.right - rect.left;
impl->unscaled_height = rect.bottom - rect.top;
_gdk_surface_update_size (window);
- if (window->event_mask & GDK_STRUCTURE_MASK)
- {
- GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
+ event = gdk_event_new (GDK_CONFIGURE);
- event->any.surface = window;
+ event->any.surface = window;
- event->configure.width = window->width;
- event->configure.height = window->height;
+ event->configure.width = window->width;
+ event->configure.height = window->height;
- event->configure.x = window->x;
- event->configure.y = window->y;
+ event->configure.x = window->x;
+ event->configure.y = window->y;
- _gdk_win32_append_event (event);
- }
+ _gdk_win32_append_event (event);
}
void
((HIWORD(msg->lParam) & KF_REPEAT) >= 1))
break;
- if (keyboard_grab &&
- !propagate (&window, msg,
- keyboard_grab->surface,
- keyboard_grab->owner_events,
- GDK_ALL_EVENTS_MASK,
- doesnt_want_key))
- break;
-
if (GDK_SURFACE_DESTROYED (window))
break;
if (!(msg->lParam & GCS_RESULTSTR))
break;
- if (keyboard_grab &&
- !propagate (&window, msg,
- keyboard_grab->surface,
- keyboard_grab->owner_events,
- GDK_ALL_EVENTS_MASK,
- doesnt_want_char))
- break;
-
if (GDK_SURFACE_DESTROYED (window))
break;
for (i = 0; i < ccount; i++)
{
- if (window->event_mask & GDK_KEY_PRESS_MASK)
- {
- /* Build a key press event */
- event = gdk_event_new (GDK_KEY_PRESS);
- event->any.surface = window;
- gdk_event_set_device (event, device_manager_win32->core_keyboard);
- gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
- build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
-
- _gdk_win32_append_event (event);
- }
-
- if (window->event_mask & GDK_KEY_RELEASE_MASK)
- {
- /* Build a key release event. */
- event = gdk_event_new (GDK_KEY_RELEASE);
- event->any.surface = window;
- gdk_event_set_device (event, device_manager_win32->core_keyboard);
- gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
- build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
-
- _gdk_win32_append_event (event);
- }
+ /* Build a key press event */
+ event = gdk_event_new (GDK_KEY_PRESS);
+ event->any.surface = window;
+ gdk_event_set_device (event, device_manager_win32->core_keyboard);
+ gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
+ build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
+
+ _gdk_win32_append_event (event);
+
+ /* Build a key release event. */
+ event = gdk_event_new (GDK_KEY_RELEASE);
+ event->any.surface = window;
+ gdk_event_set_device (event, device_manager_win32->core_keyboard);
+ gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
+ build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
+
+ _gdk_win32_append_event (event);
}
return_val = TRUE;
break;
!keyboard_grab->owner_events)
break;
- if (!(window->event_mask & GDK_FOCUS_CHANGE_MASK))
- break;
-
if (GDK_SURFACE_DESTROYED (window))
break;
void _gdk_win32_display_create_surface_impl (GdkDisplay *display,
GdkSurface *window,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
/* stray GdkSurfaceImplWin32 members */
_gdk_win32_display_create_surface_impl (GdkDisplay *display,
GdkSurface *window,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
{
HWND hwndNew;
if (!title || !*title)
title = "";
- impl->native_event_mask = GDK_STRUCTURE_MASK | event_mask;
-
if (impl->type_hint == GDK_SURFACE_TYPE_HINT_UTILITY)
dwExStyle |= WS_EX_TOOLWINDOW;
window->height = (impl->unscaled_height + impl->surface_scale - 1) / impl->surface_scale;
window->surface_type = GDK_SURFACE_FOREIGN;
window->destroyed = FALSE;
- window->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
if (IsWindowVisible ((HWND) anid))
window->state &= (~GDK_SURFACE_STATE_WITHDRAWN);
else
GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
}
-static GdkEventMask
-gdk_win32_surface_get_events (GdkSurface *window)
-{
- GdkSurfaceImplWin32 *impl;
-
- if (GDK_SURFACE_DESTROYED (window))
- return 0;
-
- impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-
- return impl->native_event_mask;
-}
-
-static void
-gdk_win32_surface_set_events (GdkSurface *window,
- GdkEventMask event_mask)
-{
- GdkSurfaceImplWin32 *impl;
-
- impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-
- /* gdk_surface_new() always sets the GDK_STRUCTURE_MASK, so better
- * set it here, too. Not that I know or remember why it is
- * necessary, will have to test some day.
- */
- impl->native_event_mask = GDK_STRUCTURE_MASK | event_mask;
-}
-
static void
gdk_win32_surface_set_accept_focus (GdkSurface *window,
gboolean accept_focus)
wa.surface_type = GDK_SURFACE_TEMP;
wa.wclass = GDK_INPUT_OUTPUT;
wa.width = wa.height = 1;
- wa.event_mask = 0;
owner = gdk_surface_new_internal (NULL, &wa, 0, TRUE);
}
#endif
impl_class->show = gdk_win32_surface_show;
impl_class->hide = gdk_win32_surface_hide;
impl_class->withdraw = gdk_win32_surface_withdraw;
- impl_class->set_events = gdk_win32_surface_set_events;
- impl_class->get_events = gdk_win32_surface_get_events;
impl_class->raise = gdk_win32_surface_raise;
impl_class->lower = gdk_win32_surface_lower;
impl_class->restack_toplevel = gdk_win32_surface_restack_toplevel;
gint hint_flags;
GdkGeometry hints;
- GdkEventMask native_event_mask;
-
/* Non-NULL for any window that is registered as a drop target.
* For OLE2 protocol only.
*/
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
-static void gdk_x11_device_core_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask);
G_DEFINE_TYPE (GdkX11DeviceCore, gdk_x11_device_core, GDK_TYPE_DEVICE)
device_class->grab = gdk_x11_device_core_grab;
device_class->ungrab = gdk_x11_device_core_ungrab;
device_class->surface_at_position = gdk_x11_device_core_surface_at_position;
- device_class->select_surface_events = gdk_x11_device_core_select_surface_events;
}
static void
return surface;
}
-static void
-gdk_x11_device_core_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask)
-{
- GdkEventMask filter_mask, surface_mask;
- guint xmask = 0;
- gint i;
-
- surface_mask = gdk_surface_get_events (surface);
- filter_mask = GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_BUTTON2_MOTION_MASK
- | GDK_BUTTON3_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_KEY_RELEASE_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_FOCUS_CHANGE_MASK
- | GDK_PROXIMITY_IN_MASK
- | GDK_PROXIMITY_OUT_MASK
- | GDK_SCROLL_MASK;
-
- /* Filter out non-device events */
- event_mask &= filter_mask;
-
- /* Unset device events on surface mask */
- surface_mask &= ~filter_mask;
-
- /* Combine masks */
- event_mask |= surface_mask;
-
- for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
- {
- if (event_mask & (1 << (i + 1)))
- xmask |= _gdk_x11_event_mask_table[i];
- }
-
- if (GDK_SURFACE_XID (surface) != GDK_SURFACE_XROOTWIN (surface))
- xmask |= StructureNotifyMask | PropertyChangeMask;
-
- XSelectInput (GDK_SURFACE_XDISPLAY (surface),
- GDK_SURFACE_XID (surface),
- xmask);
-}
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
-static void gdk_x11_device_xi2_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask);
enum {
device_class->grab = gdk_x11_device_xi2_grab;
device_class->ungrab = gdk_x11_device_xi2_ungrab;
device_class->surface_at_position = gdk_x11_device_xi2_surface_at_position;
- device_class->select_surface_events = gdk_x11_device_xi2_select_surface_events;
g_object_class_install_property (object_class,
PROP_DEVICE_ID,
return surface;
}
-static void
-gdk_x11_device_xi2_select_surface_events (GdkDevice *device,
- GdkSurface *surface,
- GdkEventMask event_mask)
-{
- GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
- GdkX11DeviceManagerXI2 *device_manager_xi2;
- GdkDisplay *display;
- XIEventMask evmask;
-
- display = gdk_device_get_display (device);
- device_manager_xi2 = GDK_X11_DEVICE_MANAGER_XI2 (GDK_X11_DISPLAY (display)->device_manager);
-
- evmask.deviceid = device_xi2->device_id;
- evmask.mask = _gdk_x11_device_xi2_translate_event_mask (device_manager_xi2,
- event_mask,
- &evmask.mask_len);
-
- XISelectEvents (GDK_SURFACE_XDISPLAY (surface),
- GDK_SURFACE_XID (surface),
- &evmask, 1);
-
- g_free (evmask.mask);
-}
-
guchar *
_gdk_x11_device_xi2_translate_event_mask (GdkX11DeviceManagerXI2 *device_manager_xi2,
GdkEventMask event_mask,
void _gdk_x11_display_create_surface_impl (GdkDisplay *display,
GdkSurface *window,
GdkSurface *real_parent,
- GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display);
void
_gdk_x11_display_create_surface_impl (GdkDisplay *display,
- GdkSurface *surface,
- GdkSurface *real_parent,
- GdkEventMask event_mask,
- GdkSurfaceAttr *attributes)
+ GdkSurface *surface,
+ GdkSurface *real_parent,
+ GdkSurfaceAttr *attributes)
{
GdkSurfaceImplX11 *impl;
GdkX11Screen *x11_screen;
}
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
- GDK_SURFACE_XID (surface), event_mask,
+ GDK_SURFACE_XID (surface), GDK_ALL_EVENTS_MASK,
StructureNotifyMask | PropertyChangeMask);
connect_frame_clock (surface);
gdk_surface_freeze_toplevel_updates (surface);
}
-static GdkEventMask
-x_event_mask_to_gdk_event_mask (long mask)
-{
- GdkEventMask event_mask = 0;
- int i;
-
- for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
- {
- if (mask & _gdk_x11_event_mask_table[i])
- event_mask |= 1 << (i + 1);
- }
-
- return event_mask;
-}
-
/**
* gdk_x11_surface_foreign_new_for_display:
* @display: (type GdkX11Display): the #GdkDisplay where the window handle comes from.
win->surface_type = GDK_SURFACE_FOREIGN;
win->destroyed = FALSE;
- win->event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask);
-
if (attrs.map_state == IsUnmapped)
win->state = GDK_SURFACE_STATE_WITHDRAWN;
else
return child != NULL;
}
-static GdkEventMask
-gdk_surface_x11_get_events (GdkSurface *surface)
-{
- XWindowAttributes attrs;
- GdkEventMask event_mask;
- GdkEventMask filtered;
-
- if (GDK_SURFACE_DESTROYED (surface))
- return 0;
- else
- {
- XGetWindowAttributes (GDK_SURFACE_XDISPLAY (surface),
- GDK_SURFACE_XID (surface),
- &attrs);
- event_mask = x_event_mask_to_gdk_event_mask (attrs.your_event_mask);
- /* if property change was filtered out before, keep it filtered out */
- filtered = GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK;
- surface->event_mask = event_mask & ((surface->event_mask & filtered) | ~filtered);
-
- return event_mask;
- }
-}
-static void
-gdk_surface_x11_set_events (GdkSurface *surface,
- GdkEventMask event_mask)
-{
- long xevent_mask = 0;
-
- if (!GDK_SURFACE_DESTROYED (surface))
- {
- GdkX11Display *display_x11;
-
- if (GDK_SURFACE_XID (surface) != GDK_SURFACE_XROOTWIN (surface))
- xevent_mask = StructureNotifyMask | PropertyChangeMask;
-
- display_x11 = GDK_X11_DISPLAY (gdk_surface_get_display (surface));
- gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
- GDK_SURFACE_XID (surface), event_mask,
- xevent_mask);
- }
-}
-
static void
gdk_surface_x11_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
impl_class->show = gdk_surface_x11_show;
impl_class->hide = gdk_surface_x11_hide;
impl_class->withdraw = gdk_surface_x11_withdraw;
- impl_class->set_events = gdk_surface_x11_set_events;
- impl_class->get_events = gdk_surface_x11_get_events;
impl_class->raise = gdk_surface_x11_raise;
impl_class->lower = gdk_surface_x11_lower;
impl_class->restack_toplevel = gdk_surface_x11_restack_toplevel;
for (d = devices; d; d = d->next)
{
- GdkDevice *dev = d->data;
GdkEvent *fevent;
GdkSurface *surface;
- /* Skip non-master keyboards that haven't
- * selected for events from this surface
- */
surface = gtk_widget_get_surface (widget);
- if (gdk_device_get_device_type (dev) != GDK_DEVICE_TYPE_MASTER &&
- !gdk_surface_get_device_events (surface, dev))
- continue;
fevent = gdk_event_new (GDK_FOCUS_CHANGE);
GdkEvent *fevent;
GdkSurface *surface;
- /* Skip non-master keyboards that haven't
- * selected for events from this surface
- */
surface = _gtk_widget_get_surface (widget);
- if (gdk_device_get_device_type (dev) != GDK_DEVICE_TYPE_MASTER &&
- surface && !gdk_surface_get_device_events (surface, dev))
- continue;
fevent = gdk_event_new (GDK_FOCUS_CHANGE);
gdk_event_set_display (fevent, gtk_widget_get_display (widget));