surface: Remove gdk_surface_is_viewable()

It returns the same value as gdk_surface_get_mapped(), so use that
instead.
This commit is contained in:
Benjamin Otte 2020-05-17 00:41:44 +02:00
parent d9c0d98871
commit 0c6266fd1a
11 changed files with 13 additions and 92 deletions

View File

@ -185,7 +185,6 @@ gdk_surface_destroy
gdk_surface_is_destroyed
gdk_surface_get_display
gdk_surface_hide
gdk_surface_is_viewable
gdk_surface_get_mapped
gdk_surface_translate_coordinates
gdk_surface_begin_resize_drag

View File

@ -585,7 +585,6 @@ static void
show_popup (GdkSurface *surface)
{
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_broadway_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@ -1569,15 +1568,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_broadway_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean

View File

@ -175,7 +175,6 @@ void gdk_surface_invalidate_region (GdkSurface *surface,
const cairo_region_t *region);
void _gdk_surface_clear_update_area (GdkSurface *surface);
void _gdk_surface_update_size (GdkSurface *surface);
gboolean _gdk_surface_update_viewable (GdkSurface *surface);
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
GError **error);
void gdk_surface_get_unscaled_size (GdkSurface *surface,

View File

@ -960,28 +960,6 @@ gdk_surface_get_mapped (GdkSurface *surface)
return GDK_SURFACE_IS_MAPPED (surface);
}
/**
* gdk_surface_is_viewable:
* @surface: a #GdkSurface
*
* Check if the surface and all ancestors of the surface are
* mapped. (This is not necessarily "viewable" in the X sense, since
* we only check as far as we have GDK surface parents, not to the root
* surface.)
*
* Returns: %TRUE if the surface is viewable
**/
gboolean
gdk_surface_is_viewable (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
if (surface->destroyed)
return FALSE;
return surface->viewable;
}
GdkGLContext *
gdk_surface_get_shared_data_gl_context (GdkSurface *surface)
{
@ -1253,7 +1231,7 @@ gdk_surface_process_updates_internal (GdkSurface *surface)
surface->active_update_area = surface->update_area;
surface->update_area = NULL;
if (gdk_surface_is_viewable (surface))
if (GDK_SURFACE_IS_MAPPED (surface))
{
cairo_region_t *expose_region;
gboolean handled;
@ -1321,10 +1299,7 @@ gdk_surface_invalidate_rect (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (!surface->viewable)
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
if (!rect)
@ -1400,10 +1375,10 @@ gdk_surface_invalidate_region (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
if (!surface->viewable || cairo_region_is_empty (region))
if (cairo_region_is_empty (region))
return;
r.x = 0;
@ -1694,25 +1669,6 @@ gdk_surface_get_device_position (GdkSurface *surface,
*mask = tmp_mask;
}
/* Returns TRUE If the native surface was mapped or unmapped */
static gboolean
set_viewable (GdkSurface *w,
gboolean val)
{
if (w->viewable == val)
return FALSE;
w->viewable = val;
return FALSE;
}
gboolean
_gdk_surface_update_viewable (GdkSurface *surface)
{
return set_viewable (surface, GDK_SURFACE_IS_MAPPED (surface));
}
/**
* gdk_surface_hide:
* @surface: a #GdkSurface
@ -2783,8 +2739,6 @@ gdk_surface_set_state (GdkSurface *surface,
mapped = GDK_SURFACE_IS_MAPPED (surface);
sticky = GDK_SURFACE_IS_STICKY (surface);
_gdk_surface_update_viewable (surface);
if (GDK_IS_TOPLEVEL (surface))
g_object_notify (G_OBJECT (surface), "state");

View File

@ -160,9 +160,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_set_input_region (GdkSurface *surface,
cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_viewable (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_get_mapped (GdkSurface *surface);

View File

@ -71,7 +71,6 @@ struct _GdkSurface
guint destroyed : 2;
guint support_multidevice : 1;
guint viewable : 1; /* mapped and all parents mapped */
guint in_update : 1;
guint frame_clock_events_paused : 1;
guint autohide : 1;

View File

@ -4603,15 +4603,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_wayland_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean

View File

@ -1327,7 +1327,6 @@ show_popup (GdkSurface *surface)
{
gdk_win32_surface_raise (surface);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
show_window_internal (surface, FALSE, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@ -4990,15 +4989,10 @@ show_surface (GdkSurface *surface)
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_win32_surface_show (surface, FALSE);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean

View File

@ -1515,7 +1515,6 @@ show_popup (GdkSurface *surface)
{
gdk_x11_surface_raise (surface);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@ -4929,6 +4928,7 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean was_mapped;
gdk_x11_surface_unminimize (surface);
@ -4964,10 +4964,6 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
else
gdk_x11_surface_unfullscreen (surface);
{
gboolean was_mapped;
gboolean did_show;
if (surface->destroyed)
return TRUE;
@ -4976,16 +4972,10 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
did_show = _gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, !did_show ? was_mapped : TRUE);
gdk_x11_surface_show (surface, was_mapped);
if (!was_mapped)
{
if (gdk_surface_is_viewable (surface))
gdk_surface_invalidate_rect (surface, NULL);
}
}
gdk_surface_invalidate_rect (surface, NULL);
return TRUE;
}

View File

@ -351,7 +351,7 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
native = gtk_widget_get_native (widget);
if (!native ||
!gdk_surface_is_viewable(gtk_native_get_surface (native)))
!gdk_surface_get_mapped (gtk_native_get_surface (native)))
{
g_object_unref (shortcut);
continue;

View File

@ -4519,7 +4519,7 @@ event_surface_is_still_viewable (GdkEvent *event)
case GDK_ENTER_NOTIFY:
case GDK_PROXIMITY_IN:
case GDK_SCROLL:
return gdk_surface_is_viewable (gdk_event_get_surface (event));
return gdk_surface_get_mapped (gdk_event_get_surface (event));
#if 0
/* The following events are the second half of paired events;
@ -4578,7 +4578,7 @@ gtk_widget_event (GtkWidget *widget,
double x, y;
/* We check only once for is-still-visible; if someone
* hides the window in on of the signals on the widget,
* hides the window in one of the signals on the widget,
* they are responsible for returning TRUE to terminate
* handling.
*/