gdk: Remove GDK_SURFACE_FOREIGN

We don't create surfaces of that type anymore.
This commit is contained in:
Benjamin Otte 2018-06-26 00:47:40 +02:00
parent 7869ffbb49
commit d13843ee2a
11 changed files with 131 additions and 208 deletions

View File

@ -631,8 +631,7 @@ get_current_toplevel (GdkDisplay *display,
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE); pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
if (pointer_surface != NULL && if (pointer_surface != NULL &&
(GDK_SURFACE_DESTROYED (pointer_surface) || GDK_SURFACE_DESTROYED (pointer_surface))
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
pointer_surface = NULL; pointer_surface = NULL;
*x_out = round (x); *x_out = round (x);

View File

@ -333,16 +333,8 @@ gdk_surface_finalize (GObject *object)
if (!GDK_SURFACE_DESTROYED (surface)) if (!GDK_SURFACE_DESTROYED (surface))
{ {
if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN) g_warning ("losing last reference to undestroyed surface");
{ _gdk_surface_destroy (surface, FALSE);
g_warning ("losing last reference to undestroyed surface");
_gdk_surface_destroy (surface, FALSE);
}
else
/* We use TRUE here, to keep us from actually calling
* XDestroyWindow() on the window
*/
_gdk_surface_destroy (surface, TRUE);
} }
if (surface->impl) if (surface->impl)
@ -656,12 +648,6 @@ gdk_surface_new (GdkDisplay *display,
#endif #endif
break; break;
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
{
g_warning (G_STRLOC "Child surfaces must not be created as children of\n"
"a surface of type GDK_SURFACE_FOREIGN");
return NULL;
}
break; break;
default: default:
g_warning (G_STRLOC "cannot make surfaces of type %d", surface->surface_type); g_warning (G_STRLOC "cannot make surfaces of type %d", surface->surface_type);
@ -897,81 +883,69 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
case GDK_SURFACE_TOPLEVEL: case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
case GDK_SURFACE_TEMP: case GDK_SURFACE_TEMP:
case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_SUBSURFACE: case GDK_SURFACE_SUBSURFACE:
if (surface->surface_type == GDK_SURFACE_FOREIGN && !foreign_destroy) if (surface->parent)
{ {
if (surface->parent->children)
surface->parent->children = g_list_remove_link (surface->parent->children, &surface->children_list_node);
if (!recursing &&
GDK_SURFACE_IS_MAPPED (surface))
{
recompute_visible_regions (surface, FALSE);
gdk_surface_invalidate_in_parent (surface);
}
} }
if (surface->gl_paint_context)
{
/* Make sure to destroy if current */
g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
g_object_unref (surface->gl_paint_context);
surface->gl_paint_context = NULL;
}
if (surface->frame_clock)
{
g_object_run_dispose (G_OBJECT (surface->frame_clock));
gdk_surface_set_frame_clock (surface, NULL);
}
tmp = surface->children;
surface->children = NULL;
/* No need to free children list, its all made up of in-struct nodes */
while (tmp)
{
temp_surface = tmp->data;
tmp = tmp->next;
if (temp_surface)
_gdk_surface_destroy_hierarchy (temp_surface,
TRUE,
recursing_native || gdk_surface_has_impl (surface),
foreign_destroy);
}
_gdk_surface_clear_update_area (surface);
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
if (gdk_surface_has_impl (surface))
impl_class->destroy (surface, recursing_native, foreign_destroy);
else else
{ {
if (surface->parent) /* hide to make sure we repaint and break grabs */
{ gdk_surface_hide (surface);
if (surface->parent->children)
surface->parent->children = g_list_remove_link (surface->parent->children, &surface->children_list_node);
if (!recursing &&
GDK_SURFACE_IS_MAPPED (surface))
{
recompute_visible_regions (surface, FALSE);
gdk_surface_invalidate_in_parent (surface);
}
}
if (surface->gl_paint_context)
{
/* Make sure to destroy if current */
g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
g_object_unref (surface->gl_paint_context);
surface->gl_paint_context = NULL;
}
if (surface->frame_clock)
{
g_object_run_dispose (G_OBJECT (surface->frame_clock));
gdk_surface_set_frame_clock (surface, NULL);
}
if (surface->surface_type == GDK_SURFACE_FOREIGN)
g_assert (surface->children == NULL);
else
{
tmp = surface->children;
surface->children = NULL;
/* No need to free children list, its all made up of in-struct nodes */
while (tmp)
{
temp_surface = tmp->data;
tmp = tmp->next;
if (temp_surface)
_gdk_surface_destroy_hierarchy (temp_surface,
TRUE,
recursing_native || gdk_surface_has_impl (surface),
foreign_destroy);
}
}
_gdk_surface_clear_update_area (surface);
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
if (gdk_surface_has_impl (surface))
impl_class->destroy (surface, recursing_native, foreign_destroy);
else
{
/* hide to make sure we repaint and break grabs */
gdk_surface_hide (surface);
}
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
surface->parent = NULL;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, display);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
} }
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
surface->parent = NULL;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, display);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
break; break;
} }
} }
@ -2235,10 +2209,8 @@ _gdk_surface_update_viewable (GdkSurface *surface)
{ {
gboolean viewable; gboolean viewable;
if (surface->surface_type == GDK_SURFACE_FOREIGN) if (gdk_surface_is_toplevel (surface) ||
viewable = TRUE; surface->parent->viewable)
else if (gdk_surface_is_toplevel (surface) ||
surface->parent->viewable)
viewable = GDK_SURFACE_IS_MAPPED (surface); viewable = GDK_SURFACE_IS_MAPPED (surface);
else else
viewable = FALSE; viewable = FALSE;
@ -2899,24 +2871,19 @@ gdk_surface_set_cursor_internal (GdkSurface *surface,
GdkDevice *device, GdkDevice *device,
GdkCursor *cursor) GdkCursor *cursor)
{ {
GdkPointerSurfaceInfo *pointer_info;
GdkDisplay *display;
if (GDK_SURFACE_DESTROYED (surface)) if (GDK_SURFACE_DESTROYED (surface))
return; return;
g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device)); g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device));
if (surface->surface_type == GDK_SURFACE_FOREIGN) display = gdk_surface_get_display (surface);
GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor); pointer_info = _gdk_display_get_pointer_info (display, device);
else
{
GdkPointerSurfaceInfo *pointer_info;
GdkDisplay *display;
display = gdk_surface_get_display (surface); if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
pointer_info = _gdk_display_get_pointer_info (display, device); update_cursor (display, device);
if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
update_cursor (display, device);
}
} }
/** /**
@ -5525,7 +5492,6 @@ gdk_surface_set_state (GdkSurface *surface,
case GDK_SURFACE_TEMP: /* ? */ case GDK_SURFACE_TEMP: /* ? */
g_object_notify (G_OBJECT (surface), "state"); g_object_notify (G_OBJECT (surface), "state");
break; break;
case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
default: default:
break; break;

View File

@ -45,7 +45,6 @@ typedef struct _GdkGeometry GdkGeometry;
* @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry) * @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement * @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement
* #GtkMenu) * #GtkMenu)
* @GDK_SURFACE_FOREIGN: foreign surface (see gdk_surface_foreign_new())
* @GDK_SURFACE_SUBSURFACE: subsurface; This surface is visually * @GDK_SURFACE_SUBSURFACE: subsurface; This surface is visually
* tied to a toplevel, and is moved/stacked with it. Currently this window * tied to a toplevel, and is moved/stacked with it. Currently this window
* type is only implemented in Wayland. Since 3.14 * type is only implemented in Wayland. Since 3.14
@ -57,7 +56,6 @@ typedef enum
GDK_SURFACE_TOPLEVEL, GDK_SURFACE_TOPLEVEL,
GDK_SURFACE_CHILD, GDK_SURFACE_CHILD,
GDK_SURFACE_TEMP, GDK_SURFACE_TEMP,
GDK_SURFACE_FOREIGN,
GDK_SURFACE_SUBSURFACE GDK_SURFACE_SUBSURFACE
} GdkSurfaceType; } GdkSurfaceType;

View File

@ -222,8 +222,7 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
do { do {
window = gdk_win32_handle_table_lookup (hwnd); window = gdk_win32_handle_table_lookup (hwnd);
if (window != NULL && if (window != NULL)
GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN)
break; break;
screen_to_client (hwnd, screen_pt, &client_pt); screen_to_client (hwnd, screen_pt, &client_pt);

View File

@ -131,8 +131,7 @@ _gdk_win32_surface_tmp_unset_bg (GdkSurface *window,
return; return;
if (_gdk_surface_has_impl (window) && if (_gdk_surface_has_impl (window) &&
GDK_SURFACE_IS_WIN32 (window) && GDK_SURFACE_IS_WIN32 (window))
window->surface_type != GDK_SURFACE_FOREIGN)
tmp_unset_bg (window); tmp_unset_bg (window);
if (recurse) if (recurse)
@ -164,8 +163,7 @@ _gdk_win32_surface_tmp_reset_bg (GdkSurface *window,
return; return;
if (_gdk_surface_has_impl (window) && if (_gdk_surface_has_impl (window) &&
GDK_SURFACE_IS_WIN32 (window) && GDK_SURFACE_IS_WIN32 (window))
window->surface_type != GDK_SURFACE_FOREIGN)
{ {
tmp_reset_bg (window); tmp_reset_bg (window);
} }

View File

@ -126,9 +126,6 @@ static void gdk_win32_impl_frame_clock_after_paint (GdkFrameClock *clock,
static gboolean _gdk_surface_get_functions (GdkSurface *window, static gboolean _gdk_surface_get_functions (GdkSurface *window,
GdkWMFunction *functions); GdkWMFunction *functions);
#define SURFACE_IS_TOPLEVEL(window) \
(GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN)
struct _GdkWin32Surface { struct _GdkWin32Surface {
GdkSurface parent; GdkSurface parent;
}; };
@ -595,22 +592,14 @@ _gdk_win32_display_create_surface_impl (GdkDisplay *display,
/* The common code warns for this case. */ /* The common code warns for this case. */
hparent = GetDesktopWindow (); hparent = GetDesktopWindow ();
} }
/* Children of foreign windows aren't toplevel windows */ /* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
if (real_parent != NULL && GDK_SURFACE_TYPE (real_parent) == GDK_SURFACE_FOREIGN) if (window->surface_type == GDK_SURFACE_TOPLEVEL)
{ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
}
else else
{ dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
/* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
if (window->surface_type == GDK_SURFACE_TOPLEVEL)
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
else
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
offset_x = _gdk_offset_x; offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y; offset_y = _gdk_offset_y;
}
break; break;
case GDK_SURFACE_TEMP: case GDK_SURFACE_TEMP:
@ -645,8 +634,8 @@ _gdk_win32_display_create_surface_impl (GdkDisplay *display,
x = y = CW_USEDEFAULT; x = y = CW_USEDEFAULT;
} }
else else
{ {
/* TEMP, FOREIGN: Put these where requested */ /* TEMP: Put these where requested */
x = real_x; x = real_x;
y = real_y; y = real_y;
} }
@ -810,9 +799,8 @@ gdk_win32_surface_destroy_notify (GdkSurface *window)
if (!GDK_SURFACE_DESTROYED (window)) if (!GDK_SURFACE_DESTROYED (window))
{ {
if (GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN) g_warning ("window %p unexpectedly destroyed",
g_warning ("window %p unexpectedly destroyed", GDK_SURFACE_HWND (window));
GDK_SURFACE_HWND (window));
_gdk_surface_destroy (window, TRUE); _gdk_surface_destroy (window, TRUE);
} }
@ -1380,8 +1368,7 @@ gdk_win32_surface_move_resize (GdkSurface *window,
out: out:
surface_impl->inhibit_configure = FALSE; surface_impl->inhibit_configure = FALSE;
if (SURFACE_IS_TOPLEVEL (window)) _gdk_win32_emit_configure_event (window);
_gdk_win32_emit_configure_event (window);
} }
static void static void
@ -2175,10 +2162,6 @@ _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
if (GDK_SURFACE_DESTROYED (window)) if (GDK_SURFACE_DESTROYED (window))
return FALSE; return FALSE;
/* only toplevels can be layered */
if (!SURFACE_IS_TOPLEVEL (window))
return FALSE;
impl = GDK_SURFACE_IMPL_WIN32 (window->impl); impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
/* This is because GTK calls gdk_surface_set_decorations (window, 0), /* This is because GTK calls gdk_surface_set_decorations (window, 0),
@ -5048,7 +5031,7 @@ gdk_win32_surface_set_opacity (GdkSurface *window,
g_return_if_fail (GDK_IS_SURFACE (window)); g_return_if_fail (GDK_IS_SURFACE (window));
if (!SURFACE_IS_TOPLEVEL (window) || GDK_SURFACE_DESTROYED (window)) if (GDK_SURFACE_DESTROYED (window))
return; return;
if (opacity < 0) if (opacity < 0)

View File

@ -533,8 +533,7 @@ gdk_x11_device_core_surface_at_position (GdkDevice *device,
break; break;
if (get_toplevel && last != root && if (get_toplevel && last != root &&
(surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL && (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL)
surface->surface_type != GDK_SURFACE_FOREIGN)
{ {
xwindow = last; xwindow = last;
break; break;

View File

@ -624,8 +624,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
break; break;
if (get_toplevel && last != root && if (get_toplevel && last != root &&
(surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL && (surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL)
GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN)
{ {
xwindow = last; xwindow = last;
break; break;

View File

@ -1355,7 +1355,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
/* Check for a local drag */ /* Check for a local drag */
surface = gdk_x11_surface_lookup_for_display (display, xid); surface = gdk_x11_surface_lookup_for_display (display, xid);
if (surface && gdk_surface_get_surface_type (surface) != GDK_SURFACE_FOREIGN) if (surface)
{ {
if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL) if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL)
{ {

View File

@ -709,9 +709,6 @@ gdk_x11_drop_filter (GdkSurface *surface,
if (xevent->type != ClientMessage) if (xevent->type != ClientMessage)
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
if (gdk_surface_get_surface_type (surface) == GDK_SURFACE_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
display = GDK_SURFACE_DISPLAY (surface); display = GDK_SURFACE_DISPLAY (surface);
for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++) for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)

View File

@ -110,11 +110,6 @@ static void move_to_current_desktop (GdkSurface *surface);
static void gdk_surface_impl_x11_finalize (GObject *object); static void gdk_surface_impl_x11_finalize (GObject *object);
#define SURFACE_IS_TOPLEVEL_OR_FOREIGN(surface) \
(GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \
GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP || \
GDK_SURFACE_TYPE (surface) == GDK_SURFACE_FOREIGN)
#define SURFACE_IS_TOPLEVEL(surface) \ #define SURFACE_IS_TOPLEVEL(surface) \
(GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \ (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TOPLEVEL || \
GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP) GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP)
@ -1068,8 +1063,7 @@ gdk_x11_surface_destroy_notify (GdkSurface *surface)
if (!GDK_SURFACE_DESTROYED (surface)) if (!GDK_SURFACE_DESTROYED (surface))
{ {
if (GDK_SURFACE_TYPE(surface) != GDK_SURFACE_FOREIGN) g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface));
g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface));
_gdk_surface_destroy (surface, TRUE); _gdk_surface_destroy (surface, TRUE);
} }
@ -1316,7 +1310,6 @@ gdk_surface_x11_hide (GdkSurface *surface)
gdk_surface_withdraw (surface); gdk_surface_withdraw (surface);
return; return;
case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_CHILD: case GDK_SURFACE_CHILD:
default: default:
break; break;
@ -1473,7 +1466,7 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
_gdk_surface_update_size (surface); _gdk_surface_update_size (surface);
toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel = _gdk_x11_surface_get_toplevel (surface);
if (toplevel && surface->surface_type != GDK_SURFACE_FOREIGN) if (toplevel)
{ {
/* These are affected by surface scale: */ /* These are affected by surface scale: */
geom_mask = toplevel->last_geometry_hints_mask & geom_mask = toplevel->last_geometry_hints_mask &
@ -1484,25 +1477,17 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
geom_mask); geom_mask);
} }
if (surface->surface_type == GDK_SURFACE_FOREIGN) if (impl->override_redirect)
XMoveWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
surface->x * impl->surface_scale,
surface->y * impl->surface_scale);
else
{ {
if (impl->override_redirect) impl->unscaled_width = surface->width * impl->surface_scale;
{ impl->unscaled_height = surface->height * impl->surface_scale;
impl->unscaled_width = surface->width * impl->surface_scale;
impl->unscaled_height = surface->height * impl->surface_scale;
}
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
surface->width * impl->surface_scale,
surface->height * impl->surface_scale);
} }
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
surface->width * impl->surface_scale,
surface->height * impl->surface_scale);
gdk_surface_invalidate_rect (surface, NULL); gdk_surface_invalidate_rect (surface, NULL);
} }
@ -1668,7 +1653,7 @@ gdk_x11_surface_focus (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = GDK_SURFACE_DISPLAY (surface); display = GDK_SURFACE_DISPLAY (surface);
@ -1718,7 +1703,7 @@ gdk_x11_surface_set_type_hint (GdkSurface *surface,
Atom atom; Atom atom;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
@ -1792,7 +1777,7 @@ gdk_x11_surface_get_type_hint (GdkSurface *surface)
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_SURFACE_TYPE_HINT_NORMAL); g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_SURFACE_TYPE_HINT_NORMAL);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return GDK_SURFACE_TYPE_HINT_NORMAL; return GDK_SURFACE_TYPE_HINT_NORMAL;
type = GDK_SURFACE_TYPE_HINT_NORMAL; type = GDK_SURFACE_TYPE_HINT_NORMAL;
@ -1879,7 +1864,7 @@ gdk_x11_surface_set_modal_hint (GdkSurface *surface,
gboolean modal) gboolean modal)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
surface->modal_hint = modal; surface->modal_hint = modal;
@ -1899,7 +1884,7 @@ gdk_x11_surface_set_skip_taskbar_hint (GdkSurface *surface,
g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel = _gdk_x11_surface_get_toplevel (surface);
@ -1920,7 +1905,7 @@ gdk_x11_surface_set_skip_pager_hint (GdkSurface *surface,
g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel = _gdk_x11_surface_get_toplevel (surface);
@ -1941,7 +1926,7 @@ gdk_x11_surface_set_urgency_hint (GdkSurface *surface,
g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD); g_return_if_fail (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_CHILD);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel = _gdk_x11_surface_get_toplevel (surface);
@ -1960,7 +1945,7 @@ gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
GdkToplevelX11 *toplevel; GdkToplevelX11 *toplevel;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
toplevel = _gdk_x11_surface_get_toplevel (surface); toplevel = _gdk_x11_surface_get_toplevel (surface);
@ -2083,7 +2068,7 @@ gdk_surface_get_geometry_hints (GdkSurface *surface,
*geom_mask = 0; *geom_mask = 0;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
impl = GDK_SURFACE_IMPL_X11 (surface->impl); impl = GDK_SURFACE_IMPL_X11 (surface->impl);
@ -2232,7 +2217,7 @@ gdk_x11_surface_set_title (GdkSurface *surface,
g_return_if_fail (title != NULL); g_return_if_fail (title != NULL);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
@ -2263,7 +2248,7 @@ gdk_x11_surface_set_role (GdkSurface *surface,
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (role) if (role)
@ -2286,7 +2271,7 @@ gdk_x11_surface_set_startup_id (GdkSurface *surface,
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (startup_id) if (startup_id)
@ -2304,7 +2289,7 @@ gdk_x11_surface_set_transient_for (GdkSurface *surface,
GdkSurface *parent) GdkSurface *parent)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
/* XSetTransientForHint() doesn't allow unsetting, so do it manually */ /* XSetTransientForHint() doesn't allow unsetting, so do it manually */
@ -2639,7 +2624,7 @@ gdk_x11_surface_set_accept_focus (GdkSurface *surface,
surface->accept_focus = accept_focus; surface->accept_focus = accept_focus;
if (!GDK_SURFACE_DESTROYED (surface) && if (!GDK_SURFACE_DESTROYED (surface) &&
SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) SURFACE_IS_TOPLEVEL (surface))
update_wm_hints (surface, FALSE); update_wm_hints (surface, FALSE);
} }
} }
@ -2656,7 +2641,7 @@ gdk_x11_surface_set_focus_on_map (GdkSurface *surface,
if ((!GDK_SURFACE_DESTROYED (surface)) && if ((!GDK_SURFACE_DESTROYED (surface)) &&
(!surface->focus_on_map) && (!surface->focus_on_map) &&
SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) SURFACE_IS_TOPLEVEL (surface))
gdk_x11_surface_set_user_time (surface, 0); gdk_x11_surface_set_user_time (surface, 0);
} }
} }
@ -2690,7 +2675,7 @@ gdk_x11_surface_set_user_time (GdkSurface *surface,
Window xid; Window xid;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
@ -2933,7 +2918,7 @@ gdk_x11_surface_set_icon_list (GdkSurface *surface,
gint i, n; gint i, n;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
@ -3015,7 +3000,7 @@ gdk_x11_surface_set_icon_name (GdkSurface *surface,
GdkDisplay *display; GdkDisplay *display;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
display = gdk_surface_get_display (surface); display = gdk_surface_get_display (surface);
@ -3050,7 +3035,7 @@ static void
gdk_x11_surface_iconify (GdkSurface *surface) gdk_x11_surface_iconify (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3075,7 +3060,7 @@ static void
gdk_x11_surface_deiconify (GdkSurface *surface) gdk_x11_surface_deiconify (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3101,7 +3086,7 @@ static void
gdk_x11_surface_stick (GdkSurface *surface) gdk_x11_surface_stick (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3149,7 +3134,7 @@ static void
gdk_x11_surface_unstick (GdkSurface *surface) gdk_x11_surface_unstick (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3175,7 +3160,7 @@ static void
gdk_x11_surface_maximize (GdkSurface *surface) gdk_x11_surface_maximize (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3192,7 +3177,7 @@ static void
gdk_x11_surface_unmaximize (GdkSurface *surface) gdk_x11_surface_unmaximize (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3209,7 +3194,7 @@ static void
gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface) gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
/* _NET_WM_FULLSCREEN_MONITORS gives an indication to the window manager as /* _NET_WM_FULLSCREEN_MONITORS gives an indication to the window manager as
@ -3301,7 +3286,7 @@ static void
gdk_x11_surface_fullscreen (GdkSurface *surface) gdk_x11_surface_fullscreen (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3328,7 +3313,7 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface,
GdkRectangle geom; GdkRectangle geom;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
gdk_monitor_get_geometry (monitor, &geom); gdk_monitor_get_geometry (monitor, &geom);
@ -3342,7 +3327,7 @@ static void
gdk_x11_surface_unfullscreen (GdkSurface *surface) gdk_x11_surface_unfullscreen (GdkSurface *surface)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3363,7 +3348,7 @@ gdk_x11_surface_set_keep_above (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3388,7 +3373,7 @@ gdk_x11_surface_set_keep_below (GdkSurface *surface, gboolean setting)
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
if (GDK_SURFACE_IS_MAPPED (surface)) if (GDK_SURFACE_IS_MAPPED (surface))
@ -3539,7 +3524,7 @@ gdk_x11_surface_set_decorations (GdkSurface *surface,
MotifWmHints hints; MotifWmHints hints;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
/* initialize to zero to avoid writing uninitialized data to socket */ /* initialize to zero to avoid writing uninitialized data to socket */
@ -3558,7 +3543,7 @@ gdk_x11_surface_get_decorations(GdkSurface *surface,
gboolean result = FALSE; gboolean result = FALSE;
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return FALSE; return FALSE;
hints = gdk_surface_get_mwm_hints (surface); hints = gdk_surface_get_mwm_hints (surface);
@ -3587,7 +3572,7 @@ gdk_x11_surface_set_functions (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
/* initialize to zero to avoid writing uninitialized data to socket */ /* initialize to zero to avoid writing uninitialized data to socket */
@ -4369,7 +4354,7 @@ gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
guint32 timestamp) guint32 timestamp)
{ {
if (GDK_SURFACE_DESTROYED (surface) || if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL_OR_FOREIGN (surface)) !SURFACE_IS_TOPLEVEL (surface))
return; return;
/* Avoid EWMH for touch devices */ /* Avoid EWMH for touch devices */