Commit 3dce0dcc authored by Alexander Larsson's avatar Alexander Larsson

GdkSurface: Rename lots of stuff from window->surface

Mostly these are internal things, but the major public change is
that event.window is now event.surface.
parent 9a7e7211
......@@ -657,7 +657,7 @@ gdk_event_get_scroll_deltas
gdk_event_is_scroll_stop_event
gdk_event_get_state
gdk_event_get_time
gdk_event_get_window
gdk_event_get_surface
gdk_event_get_event_type
GdkEventSequence
gdk_event_get_event_sequence
......
......@@ -10,17 +10,17 @@ GdkDisplay * gdk_display_open_default (void);
gboolean gdk_device_grab_info (GdkDisplay *display,
GdkDevice *device,
GdkSurface **grab_window,
GdkSurface **grab_surface,
gboolean *owner_events);
void gdk_pre_parse (void);
void gdk_surface_freeze_toplevel_updates (GdkSurface *window);
void gdk_surface_thaw_toplevel_updates (GdkSurface *window);
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *window);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
void gdk_surface_move_to_rect (GdkSurface *window,
void gdk_surface_move_to_rect (GdkSurface *surface,
const GdkRectangle *rect,
GdkGravity rect_anchor,
GdkGravity surface_anchor,
......
......@@ -240,8 +240,8 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
/**
* gdk_cairo_surface_create_from_pixbuf:
* @pixbuf: a #GdkPixbuf
* @scale: the scale of the new surface, or 0 to use same as @window
* @for_surface: (allow-none): The window this will be drawn to, or %NULL
* @scale: the scale of the new surface, or 0 to use same as @surface
* @for_surface: (allow-none): The surface this will be drawn to, or %NULL
*
* Creates an image surface with the same contents as
* the pixbuf.
......
......@@ -61,7 +61,7 @@ cairo_surface_t * gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pi
GdkSurface *for_surface);
GDK_AVAILABLE_IN_ALL
void gdk_cairo_draw_from_gl (cairo_t *cr,
GdkSurface *window,
GdkSurface *surface,
int source,
int source_type,
int buffer_scale,
......
......@@ -502,30 +502,30 @@ gdk_device_get_property (GObject *object,
/**
* gdk_device_get_state: (skip)
* @device: a #GdkDevice.
* @window: a #GdkSurface.
* @surface: a #GdkSurface.
* @axes: (nullable) (array): an array of doubles to store the values of
* the axes of @device in, or %NULL.
* @mask: (optional) (out): location to store the modifiers, or %NULL.
*
* Gets the current state of a pointer device relative to @window. As a slave
* Gets the current state of a pointer device relative to @surface. As a slave
* device’s coordinates are those of its master pointer, this
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them. See gdk_device_grab().
*/
void
gdk_device_get_state (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (GDK_IS_SURFACE (window));
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
if (GDK_DEVICE_GET_CLASS (device)->get_state)
GDK_DEVICE_GET_CLASS (device)->get_state (device, window, axes, mask);
GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask);
}
/**
......@@ -597,12 +597,12 @@ gdk_device_get_position (GdkDevice *device,
* gdk_device_get_surface_at_position_double:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
*
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y in
* double precision. Returns %NULL if the window tree under @device is not known to GDK (for example,
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y in
* double precision. Returns %NULL if the surface tree under @device is not known to GDK (for example,
* belongs to another application).
*
* As a slave device coordinates are those of its master pointer, This
......@@ -618,19 +618,19 @@ gdk_device_get_surface_at_position_double (GdkDevice *device,
gdouble *win_y)
{
gdouble tmp_x, tmp_y;
GdkSurface *window;
GdkSurface *surface;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
window = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
/* This might need corrections, as the native window returned
/* This might need corrections, as the native surface returned
may contain client side children */
if (window)
window = _gdk_surface_find_descendant_at (window,
if (surface)
surface = _gdk_surface_find_descendant_at (surface,
tmp_x, tmp_y,
&tmp_x, &tmp_y);
......@@ -639,19 +639,19 @@ gdk_device_get_surface_at_position_double (GdkDevice *device,
if (win_y)
*win_y = tmp_y;
return window;
return surface;
}
/**
* gdk_device_get_surface_at_position:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
*
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the surface tree under @device is not known to GDK (for example, belongs to another application).
*
* As a slave device coordinates are those of its master pointer, This
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
......@@ -666,9 +666,9 @@ gdk_device_get_surface_at_position (GdkDevice *device,
gint *win_y)
{
gdouble tmp_x, tmp_y;
GdkSurface *window;
GdkSurface *surface;
window =
surface =
gdk_device_get_surface_at_position_double (device, &tmp_x, &tmp_y);
if (win_x)
......@@ -676,13 +676,13 @@ gdk_device_get_surface_at_position (GdkDevice *device,
if (win_y)
*win_y = round (tmp_y);
return window;
return surface;
}
/**
* gdk_device_get_history: (skip)
* @device: a #GdkDevice
* @window: the window with respect to which which the event coordinates will be reported
* @surface: the surface with respect to which which the event coordinates will be reported
* @start: starting timestamp for range of events to return
* @stop: ending timestamp for the range of events to return
* @events: (array length=n_events) (out) (transfer full) (optional):
......@@ -707,7 +707,7 @@ gdk_device_get_surface_at_position (GdkDevice *device,
**/
gboolean
gdk_device_get_history (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
......@@ -715,7 +715,7 @@ gdk_device_get_history (GdkDevice *device,
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (GDK_IS_SURFACE (window), FALSE);
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
if (n_events)
*n_events = 0;
......@@ -723,13 +723,13 @@ gdk_device_get_history (GdkDevice *device,
if (events)
*events = NULL;
if (GDK_SURFACE_DESTROYED (window))
if (GDK_SURFACE_DESTROYED (surface))
return FALSE;
if (!GDK_DEVICE_GET_CLASS (device)->get_history)
return FALSE;
return GDK_DEVICE_GET_CLASS (device)->get_history (device, window,
return GDK_DEVICE_GET_CLASS (device)->get_history (device, surface,
start, stop,
events, n_events);
}
......@@ -838,7 +838,7 @@ gdk_device_get_mode (GdkDevice *device)
*
* Sets a the mode of an input device. The mode controls if the
* device is active and whether the device’s range is mapped to the
* entire screen or to a single window.
* entire screen or to a single surface.
*
* Note: This is only meaningful for floating devices, master devices (and
* slaves connected to these) drive the pointer cursor, which is not limited
......@@ -1311,19 +1311,19 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
* or gdk_event_get_device() if the grab is in reaction to an event. Also, you can use
* gdk_seat_get_pointer() but only in code that isn’t triggered by a
* #GdkEvent and there aren’t other means to get a meaningful #GdkDevice to operate on.
* @window: the #GdkSurface which will own the grab (the grab window)
* @surface: the #GdkSurface which will own the grab (the grab surface)
* @grab_ownership: specifies the grab ownership.
* @owner_events: if %FALSE then all device events are reported with respect to
* @window and are only reported if selected by @event_mask. If
* @surface and are only reported if selected by @event_mask. If
* %TRUE then pointer events for this application are reported
* as normal, but pointer events outside this application are
* reported with respect to @window and only if selected by
* reported with respect to @surface and only if selected by
* @event_mask. In either mode, unreported events are discarded.
* @event_mask: specifies the event mask, which is used in accordance with
* @owner_events.
* @cursor: (allow-none): the cursor to display while the grab is active if the device is
* a pointer. If this is %NULL then the normal cursors are used for
* @window and its descendants, and the cursor for @window is used
* @surface and its descendants, and the cursor for @surface is used
* elsewhere.
* @time_: the timestamp of the event which led to this pointer grab. This
* usually comes from the #GdkEvent struct, though %GDK_CURRENT_TIME
......@@ -1331,10 +1331,10 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
*
* Grabs the device so that all events coming from this device are passed to
* this application until the device is ungrabbed with gdk_device_ungrab(),
* or the window becomes unviewable. This overrides any previous grab on the device
* or the surface becomes unviewable. This overrides any previous grab on the device
* by this client.
*
* Note that @device and @window need to be on the same display.
* Note that @device and @surface need to be on the same display.
*
* Device grabs are used for operations which need complete control over the
* given device events (either pointer or keyboard). For example in GTK+ this
......@@ -1344,7 +1344,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
* and button release events, then a button press event will cause an automatic
* pointer grab until the button is released. X does this automatically since
* most applications expect to receive button press and release events in pairs.
* It is equivalent to a pointer grab on the window with @owner_events set to
* It is equivalent to a pointer grab on the surface with @owner_events set to
* %TRUE.
*
* If you set up anything at the time you take the grab that needs to be
......@@ -1357,7 +1357,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
**/
GdkGrabStatus
gdk_device_grab (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
......@@ -1368,10 +1368,10 @@ gdk_device_grab (GdkDevice *device,
GdkSurface *native;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_FAILED);
g_return_val_if_fail (GDK_IS_SURFACE (window), GDK_GRAB_FAILED);
g_return_val_if_fail (gdk_surface_get_display (window) == gdk_device_get_display (device), GDK_GRAB_FAILED);
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (device), GDK_GRAB_FAILED);
native = gdk_surface_get_toplevel (window);
native = gdk_surface_get_toplevel (surface);
if (native == NULL || GDK_SURFACE_DESTROYED (native))
return GDK_GRAB_NOT_VIEWABLE;
......@@ -1389,12 +1389,12 @@ gdk_device_grab (GdkDevice *device,
GdkDisplay *display;
gulong serial;
display = gdk_surface_get_display (window);
display = gdk_surface_get_display (surface);
serial = _gdk_display_get_next_serial (display);
_gdk_display_add_device_grab (display,
device,
window,
surface,
native,
grab_ownership,
owner_events,
......@@ -1432,7 +1432,7 @@ gdk_device_ungrab (GdkDevice *device,
* @y: the Y coordinate of the destination.
*
* Warps @device in @display to the point @x,@y,
* unless the device is confined to a window by a grab,
* unless the device is confined to a surface by a grab,
* in which case it will be moved
* as far as allowed by the grab. Warping the pointer
* creates events as if the user had moved the mouse
......@@ -1567,7 +1567,7 @@ find_axis_info (GArray *array,
gboolean
_gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
guint index_,
gdouble value,
gdouble *axis_value)
......@@ -1580,7 +1580,7 @@ _gdk_device_translate_surface_coord (GdkDevice *device,
gdouble x_min, y_min;
gdouble x_resolution, y_resolution;
gdouble device_aspect;
gint window_width, window_height;
gint surface_width, surface_height;
if (index_ >= device->axes->len)
return FALSE;
......@@ -1608,8 +1608,8 @@ _gdk_device_translate_surface_coord (GdkDevice *device,
x_min = axis_info_x->min_value;
y_min = axis_info_y->min_value;
window_width = gdk_surface_get_width (window);
window_height = gdk_surface_get_height (window);
surface_width = gdk_surface_get_width (surface);
surface_height = gdk_surface_get_height (surface);
x_resolution = axis_info_x->resolution;
y_resolution = axis_info_y->resolution;
......@@ -1633,23 +1633,23 @@ _gdk_device_translate_surface_coord (GdkDevice *device,
device_aspect = (device_height * y_resolution) /
(device_width * x_resolution);
if (device_aspect * window_width >= window_height)
if (device_aspect * surface_width >= surface_height)
{
/* device taller than window */
x_scale = window_width / device_width;
/* device taller than surface */
x_scale = surface_width / device_width;
y_scale = (x_scale * x_resolution) / y_resolution;
x_offset = 0;
y_offset = - (device_height * y_scale - window_height) / 2;
y_offset = - (device_height * y_scale - surface_height) / 2;
}
else
{
/* window taller than device */
y_scale = window_height / device_height;
/* surface taller than device */
y_scale = surface_height / device_height;
x_scale = (y_scale * y_resolution) / x_resolution;
y_offset = 0;
x_offset = - (device_width * x_scale - window_width) / 2;
x_offset = - (device_width * x_scale - surface_width) / 2;
}
if (axis_value)
......@@ -1665,9 +1665,9 @@ _gdk_device_translate_surface_coord (GdkDevice *device,
gboolean
_gdk_device_translate_screen_coord (GdkDevice *device,
GdkSurface *window,
gdouble window_root_x,
gdouble window_root_y,
GdkSurface *surface,
gdouble surface_root_x,
gdouble surface_root_y,
gdouble screen_width,
gdouble screen_height,
guint index_,
......@@ -1698,7 +1698,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_x - window->abs_x;
offset = - surface_root_x - surface->abs_x;
}
else
{
......@@ -1707,7 +1707,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_y - window->abs_y;
offset = - surface_root_y - surface->abs_y;
}
if (axis_value)
......@@ -1746,8 +1746,8 @@ _gdk_device_translate_axis (GdkDevice *device,
void
_gdk_device_query_state (GdkDevice *device,
GdkSurface *window,
GdkSurface **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
......@@ -1755,8 +1755,8 @@ _gdk_device_query_state (GdkDevice *device,
GdkModifierType *mask)
{
GDK_DEVICE_GET_CLASS (device)->query_state (device,
window,
child_window,
surface,
child_surface,
root_x,
root_y,
win_x,
......@@ -1782,13 +1782,13 @@ _gdk_device_surface_at_position (GdkDevice *device,
* gdk_device_get_last_event_surface:
* @device: a #GdkDevice, with a source other than %GDK_SOURCE_KEYBOARD
*
* Gets information about which window the given pointer device is in, based on events
* Gets information about which surface the given pointer device is in, based on events
* that have been received so far from the display server. If another application
* has a pointer grab, or this application has a grab with owner_events = %FALSE,
* %NULL may be returned even if the pointer is physically over one of this
* application's windows.
* application's surfaces.
*
* Returns: (transfer none) (allow-none): the last window the device
* Returns: (transfer none) (allow-none): the last surface the device
*/
GdkSurface *
gdk_device_get_last_event_surface (GdkDevice *device)
......
......@@ -74,9 +74,9 @@ typedef enum
* @GDK_MODE_SCREEN: the device is enabled. The device’s coordinate space
* maps to the entire screen.
* @GDK_MODE_SURFACE: the device is enabled. The device’s coordinate space
* is mapped to a single window. The manner in which this window
* is mapped to a single surface. The manner in which this surface
* is chosen is undefined, but it will typically be the same
* way in which the focus window for key events is determined.
* way in which the focus surface for key events is determined.
*
* An enumeration that describes the mode of an input device.
*/
......@@ -163,7 +163,7 @@ void gdk_device_set_axis_use (GdkDevice *device,
GDK_AVAILABLE_IN_ALL
void gdk_device_get_state (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
......@@ -188,7 +188,7 @@ GdkSurface *
gdouble *win_y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_history (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
......@@ -225,7 +225,7 @@ GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
GDK_DEPRECATED_FOR(gdk_seat_grab)
GdkGrabStatus gdk_device_grab (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
......
......@@ -71,34 +71,34 @@ struct _GdkDeviceClass
GObjectClass parent_class;
gboolean (* get_history) (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
void (* get_state) (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
void (* set_surface_cursor) (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
GdkCursor *cursor);
void (* warp) (GdkDevice *device,
gdouble x,
gdouble y);
void (* query_state) (GdkDevice *device,
GdkSurface *window,
GdkSurface **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
GdkGrabStatus (* grab) (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkSurface *confine_to,
......@@ -113,7 +113,7 @@ struct _GdkDeviceClass
GdkModifierType *mask,
gboolean get_toplevel);
void (* select_surface_events) (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
GdkEventMask event_mask);
};
......@@ -139,15 +139,15 @@ void _gdk_device_set_keys (GdkDevice *device,
guint num_keys);
gboolean _gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
guint index,
gdouble value,
gdouble *axis_value);
gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
GdkSurface *window,
gdouble window_root_x,
gdouble window_root_y,
GdkSurface *surface,
gdouble surface_root_x,
gdouble surface_root_y,
gdouble screen_width,
gdouble screen_height,
guint index,
......@@ -167,8 +167,8 @@ void _gdk_device_add_slave (GdkDevice *device,
void _gdk_device_remove_slave (GdkDevice *device,
GdkDevice *slave);
void _gdk_device_query_state (GdkDevice *device,
GdkSurface *window,
GdkSurface **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
......
......@@ -335,7 +335,7 @@ free_pointer_info (GdkPointerSurfaceInfo *info)
static void
free_device_grab (GdkDeviceGrabInfo *info)
{
g_object_unref (info->window);
g_object_unref (info->surface);
g_object_unref (info->native_surface);
g_free (info);
}
......@@ -516,22 +516,22 @@ gdk_display_put_event (GdkDisplay *display,
static void
generate_grab_broken_event (GdkDisplay *display,
GdkSurface *window,
GdkSurface *surface,
GdkDevice *device,
gboolean implicit,
GdkSurface *grab_window)
GdkSurface *grab_surface)
{
g_return_if_fail (window != NULL);
g_return_if_fail (surface != NULL);
if (!GDK_SURFACE_DESTROYED (window))
if (!GDK_SURFACE_DESTROYED (surface))
{
GdkEvent *event;
event = gdk_event_new (GDK_GRAB_BROKEN);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->any.send_event = FALSE;
event->grab_broken.implicit = implicit;
event->grab_broken.grab_window = grab_window;
event->grab_broken.grab_surface = grab_surface;
gdk_event_set_device (event, device);
event->grab_broken.keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
......@@ -559,7 +559,7 @@ _gdk_display_get_last_device_grab (GdkDisplay *display,
GdkDeviceGrabInfo *
_gdk_display_add_device_grab (GdkDisplay *display,
GdkDevice *device,
GdkSurface *window,
GdkSurface *surface,
GdkSurface *native_surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
......@@ -573,7 +573,7 @@ _gdk_display_add_device_grab (GdkDisplay *display,
info = g_new0 (GdkDeviceGrabInfo, 1);
info->window = g_object_ref (window);
info->surface = g_object_ref (surface);
info->native_surface = g_object_ref (native_surface);
info->serial_start = serial_start;
info->serial_end = G_MAXULONG;
......@@ -626,23 +626,23 @@ get_current_toplevel (GdkDisplay *display,
int *y_out,
GdkModifierType *state_out)
{
GdkSurface *pointer_window;
GdkSurface *pointer_surface;
gdouble x, y;
GdkModifierType state;
pointer_window = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
if (pointer_window != NULL &&
(GDK_SURFACE_DESTROYED (pointer_window) ||
GDK_SURFACE_TYPE (pointer_window) == GDK_SURFACE_ROOT ||
GDK_SURFACE_TYPE (pointer_window) == GDK_SURFACE_FOREIGN))
pointer_window = NULL;
if (pointer_surface != NULL &&
(GDK_SURFACE_DESTROYED (pointer_surface) ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_ROOT ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
pointer_surface = NULL;
*x_out = round (x);
*y_out = round (y);
*state_out = state;
return pointer_window;
return pointer_surface;
}
static void
......@@ -670,9 +670,9 @@ switch_to_pointer_grab (GdkDisplay *display,
/* New grab is in effect */
if (!grab->implicit)
{
/* !owner_event Grabbing a window that we're not inside, current status is
now NULL (i.e. outside grabbed window) */
if (!grab->owner_events && info->surface_under_pointer != grab->window)
/* !owner_event Grabbing a surface that we're not inside, current status is
now NULL (i.e. outside grabbed surface) */
if (!grab->owner_events && info->surface_under_pointer != grab->surface)
_gdk_display_set_surface_under_pointer (display, device, NULL);
}
......@@ -767,11 +767,11 @@ _gdk_display_device_grab_update (GdkDisplay *display,
}
if ((next_grab == NULL && current_grab->implicit_ungrab) ||
(next_grab != NULL && current_grab->window != next_grab->window))
generate_grab_broken_event (display, GDK_SURFACE (current_grab->window),
(next_grab != NULL && current_grab->surface != next_grab->surface))
generate_grab_broken_event (display, GDK_SURFACE (current_grab->surface),
device,
current_grab->implicit,
next_grab? next_grab->window : NULL);
next_grab? next_grab->surface : NULL);
/* Remove old grab */
grabs = g_list_delete_link (grabs, grabs);
......@@ -832,7 +832,7 @@ _gdk_display_has_device_grab (GdkDisplay *display,
/* Returns true if last grab was ended
* If if_child is non-NULL, end the grab only if the grabbed
* window is the same as if_child or a descendant of it */
* surface is the same as if_child or a descendant of it */
gboolean
_gdk_display_end_device_grab (GdkDisplay *display,
GdkDevice *device,
......@@ -851,7 +851,7 @@ _gdk_display_end_device_grab (GdkDisplay *display,
grab = l->data;
if (grab &&
(if_child == NULL ||
_gdk_surface_event_parent_of (if_child, grab->window)))
_gdk_surface_event_parent_of (if_child, grab->surface)))
{
grab->serial_end = serial;
grab->implicit_ungrab = implicit;
......@@ -962,7 +962,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
* gdk_device_grab_info:
* @display: the display for which to get the grab information
* @device: device to get the grab information from
* @grab_window: (out) (transfer none): location to store current grab window
* @grab_surface: (out) (transfer none): location to store current grab surface
* @owner_events: (out): location to store boolean indicating whether
* the @owner_events flag to gdk_device_grab() was %TRUE.
*
......@@ -975,7 +975,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
gboolean
gdk_device_grab_info (GdkDisplay *display,
GdkDevice *device,
GdkSurface **grab_window,
GdkSurface **grab_surface,
gboolean *owner_events)
{
GdkDeviceGrabInfo *info;
......@@ -987,8 +987,8 @@ gdk_device_grab_info (GdkDisplay *display,
if (info)
{
if (grab_window)
*grab_window = info->window;
if (grab_surface)
*grab_surface = info->surface;
if (owner_events)
*owner_events = info->owner_events;
......@@ -1103,11 +1103,11 @@ gdk_display_flush (GdkDisplay *display)
* gdk_display_get_default_group:
* @display: a #GdkDisplay
*
* Returns the default group leader window for all toplevel windows
* on @display. This window is implicitly created by GDK.