forked from AuroraMiddleware/gtk
surface: Small cleanup
Every surface has an impl now, no need to check.
This commit is contained in:
parent
77e99f70fe
commit
0f5a6a3927
@ -325,8 +325,7 @@ void _gdk_display_set_surface_under_pointer (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkSurface *surface);
|
||||
|
||||
gboolean _gdk_surface_has_impl (GdkSurface *surface);
|
||||
GdkSurface * _gdk_surface_get_impl_surface (GdkSurface *surface);
|
||||
GdkSurface * gdk_surface_get_impl_surface (GdkSurface *surface);
|
||||
|
||||
void gdk_surface_destroy_notify (GdkSurface *surface);
|
||||
|
||||
|
@ -482,30 +482,12 @@ gdk_surface_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
GdkSurface *
|
||||
gdk_surface_get_impl_surface (GdkSurface *surface)
|
||||
{
|
||||
return surface->impl_surface;
|
||||
}
|
||||
|
||||
GdkSurface *
|
||||
_gdk_surface_get_impl_surface (GdkSurface *surface)
|
||||
{
|
||||
return gdk_surface_get_impl_surface (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_surface_has_impl (GdkSurface *surface)
|
||||
{
|
||||
return surface->impl_surface == surface;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_surface_has_impl (GdkSurface *surface)
|
||||
{
|
||||
return gdk_surface_has_impl (surface);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_surface_update_size (GdkSurface *surface)
|
||||
{
|
||||
@ -734,14 +716,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
|
||||
_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);
|
||||
}
|
||||
impl_class->destroy (surface, recursing_native, foreign_destroy);
|
||||
|
||||
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
|
||||
surface->destroyed = TRUE;
|
||||
@ -1368,12 +1343,9 @@ _gdk_surface_clear_update_area (GdkSurface *surface)
|
||||
void
|
||||
gdk_surface_freeze_updates (GdkSurface *surface)
|
||||
{
|
||||
GdkSurface *impl_surface;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl_surface = gdk_surface_get_impl_surface (surface);
|
||||
impl_surface->update_freeze_count++;
|
||||
surface->impl_surface->update_freeze_count++;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1394,7 +1366,7 @@ gdk_surface_thaw_updates (GdkSurface *surface)
|
||||
g_return_if_fail (impl_surface->update_freeze_count > 0);
|
||||
|
||||
if (--impl_surface->update_freeze_count == 0)
|
||||
gdk_surface_schedule_update (GDK_SURFACE (impl_surface));
|
||||
gdk_surface_schedule_update (impl_surface);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1639,32 +1611,13 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
||||
if (raise)
|
||||
gdk_surface_raise_internal (surface);
|
||||
|
||||
if (gdk_surface_has_impl (surface))
|
||||
{
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface,
|
||||
GDK_SURFACE_STATE_WITHDRAWN,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->state = 0;
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
}
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
|
||||
did_show = _gdk_surface_update_viewable (surface);
|
||||
|
||||
/* If it was already viewable the backend show op won't be called, call it
|
||||
again to ensure things happen right if the mapped tracking was not right
|
||||
for e.g. a foreign surface.
|
||||
Dunno if this is strictly needed but its what happened pre-csw.
|
||||
Also show if not done by gdk_surface_update_viewable. */
|
||||
if (gdk_surface_has_impl (surface) && (was_viewable || !did_show))
|
||||
{
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->show (surface, !did_show ? was_mapped : TRUE);
|
||||
}
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->show (surface, !did_show ? was_mapped : TRUE);
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
@ -1836,20 +1789,8 @@ gdk_surface_hide (GdkSurface *surface)
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
|
||||
if (gdk_surface_has_impl (surface))
|
||||
{
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (surface))
|
||||
gdk_synthesize_surface_state (surface,
|
||||
0,
|
||||
GDK_SURFACE_STATE_WITHDRAWN);
|
||||
}
|
||||
else if (was_mapped)
|
||||
{
|
||||
surface->state = GDK_SURFACE_STATE_WITHDRAWN;
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
}
|
||||
if (GDK_SURFACE_IS_MAPPED (surface))
|
||||
gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_WITHDRAWN);
|
||||
|
||||
if (was_mapped)
|
||||
{
|
||||
@ -1886,12 +1827,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
did_hide = _gdk_surface_update_viewable (surface);
|
||||
|
||||
/* Hide foreign surface as those are not handled by update_viewable. */
|
||||
if (gdk_surface_has_impl (surface) && (!did_hide))
|
||||
{
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->hide (surface);
|
||||
}
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->hide (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2479,11 +2416,8 @@ gdk_surface_input_shape_combine_region (GdkSurface *surface,
|
||||
else
|
||||
surface->input_shape = NULL;
|
||||
|
||||
if (gdk_surface_has_impl (surface))
|
||||
{
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->input_shape_combine_region (surface, surface->input_shape, 0, 0);
|
||||
}
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->input_shape_combine_region (surface, surface->input_shape, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2826,12 +2760,9 @@ gdk_surface_print (GdkSurface *surface,
|
||||
surface->width, surface->height
|
||||
);
|
||||
|
||||
if (gdk_surface_has_impl (surface))
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
g_print (" impl(0x%lx)", gdk_x11_surface_get_xid (window));
|
||||
g_print (" impl(0x%lx)", gdk_x11_surface_get_xid (window));
|
||||
#endif
|
||||
}
|
||||
|
||||
g_print (" %s", surface_types[surface->surface_type]);
|
||||
|
||||
|
@ -1505,11 +1505,8 @@ gdk_surface_quartz_get_root_coords (GdkSurface *window,
|
||||
|
||||
while (window != toplevel)
|
||||
{
|
||||
if (_gdk_surface_has_impl ((GdkSurface *)window))
|
||||
{
|
||||
tmp_x += window->x;
|
||||
tmp_y += window->y;
|
||||
}
|
||||
tmp_x += window->x;
|
||||
tmp_y += window->y;
|
||||
|
||||
window = window->parent;
|
||||
}
|
||||
|
@ -130,9 +130,7 @@ _gdk_win32_surface_tmp_unset_bg (GdkSurface *window,
|
||||
if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
|
||||
return;
|
||||
|
||||
if (_gdk_surface_has_impl (window) &&
|
||||
GDK_SURFACE_IS_WIN32 (window))
|
||||
tmp_unset_bg (window);
|
||||
tmp_unset_bg (window);
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
@ -162,11 +160,7 @@ _gdk_win32_surface_tmp_reset_bg (GdkSurface *window,
|
||||
if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
|
||||
return;
|
||||
|
||||
if (_gdk_surface_has_impl (window) &&
|
||||
GDK_SURFACE_IS_WIN32 (window))
|
||||
{
|
||||
tmp_reset_bg (window);
|
||||
}
|
||||
tmp_reset_bg (window);
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
|
@ -4475,13 +4475,6 @@ gdk_x11_get_server_time (GdkSurface *surface)
|
||||
XID
|
||||
gdk_x11_surface_get_xid (GdkSurface *surface)
|
||||
{
|
||||
if (!GDK_SURFACE_IS_X11 (surface) ||
|
||||
!_gdk_surface_has_impl (surface))
|
||||
{
|
||||
g_warning (G_STRLOC " drawable is not a native X11 window");
|
||||
return None;
|
||||
}
|
||||
|
||||
return GDK_SURFACE_IMPL_X11 (surface->impl)->xid;
|
||||
}
|
||||
|
||||
@ -4512,13 +4505,6 @@ void
|
||||
gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface,
|
||||
gboolean frame_sync_enabled)
|
||||
{
|
||||
if (!GDK_SURFACE_IS_X11 (surface) ||
|
||||
!_gdk_surface_has_impl (surface))
|
||||
{
|
||||
g_warning (G_STRLOC " drawable is not a native X11 window");
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_SURFACE_IMPL_X11 (surface->impl)->frame_sync_enabled = FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user