gdk: Drop input-only surfaces

We are not creating such surfaces anymore, and
they were only ever meaningfully implemented
on X11. Drop the concept, and the api for determining
if a surface is input-only.
This commit is contained in:
Matthias Clasen 2019-04-21 12:06:11 -04:00
parent 1a23ebf105
commit 2855729cb4
8 changed files with 80 additions and 148 deletions

View File

@ -190,7 +190,6 @@ gdk_surface_hide
gdk_surface_is_destroyed
gdk_surface_is_visible
gdk_surface_is_viewable
gdk_surface_is_input_only
gdk_surface_get_state
gdk_surface_iconify
gdk_surface_deiconify

View File

@ -160,7 +160,6 @@ struct _GdkSurface
guint8 alpha;
guint8 fullscreen_mode;
guint input_only : 1;
guint pass_through : 1;
guint modal_hint : 1;

View File

@ -475,7 +475,6 @@ _gdk_surface_update_size (GdkSurface *surface)
static GdkSurface *
gdk_surface_new (GdkDisplay *display,
gboolean input_only,
GdkSurfaceType surface_type,
int x,
int y,
@ -496,11 +495,8 @@ gdk_surface_new (GdkDisplay *display,
surface->y = y;
surface->width = width;
surface->height = height;
surface->input_only = input_only;
surface->surface_type = surface_type;
g_warn_if_fail (!surface->input_only || surface->surface_type == GDK_SURFACE_TEMP);
frame_clock = g_object_new (GDK_TYPE_FRAME_CLOCK_IDLE, NULL);
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);
@ -536,7 +532,7 @@ gdk_surface_new_toplevel (GdkDisplay *display,
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gdk_surface_new (display, FALSE, GDK_SURFACE_TOPLEVEL, 0, 0, width, height);
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL, 0, 0, width, height);
}
/**
@ -556,7 +552,7 @@ gdk_surface_new_popup (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (position != NULL, NULL);
return gdk_surface_new (display, FALSE, GDK_SURFACE_TEMP,
return gdk_surface_new (display, GDK_SURFACE_TEMP,
position->x, position->y,
position->width, position->height);
}
@ -582,7 +578,7 @@ gdk_surface_new_popup_full (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
surface = gdk_surface_new (display, FALSE, GDK_SURFACE_TEMP, 0, 0, 100, 100);
surface = gdk_surface_new (display, GDK_SURFACE_TEMP, 0, 0, 100, 100);
gdk_surface_set_transient_for (surface, parent);
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
@ -1154,7 +1150,7 @@ gdk_surface_invalidate_rect (GdkSurface *surface,
if (GDK_SURFACE_DESTROYED (surface))
return;
if (surface->input_only || !surface->viewable)
if (!surface->viewable)
return;
if (!rect)
@ -1233,9 +1229,7 @@ gdk_surface_invalidate_region (GdkSurface *surface,
if (GDK_SURFACE_DESTROYED (surface))
return;
if (surface->input_only ||
!surface->viewable ||
cairo_region_is_empty (region))
if (!surface->viewable || cairo_region_is_empty (region))
return;
r.x = 0;
@ -2452,22 +2446,6 @@ gdk_surface_get_focus_on_map (GdkSurface *surface)
return surface->focus_on_map;
}
/**
* gdk_surface_is_input_only:
* @surface: a toplevel #GdkSurface
*
* Determines whether or not the surface is an input only surface.
*
* Returns: %TRUE if @surface is input only
*/
gboolean
gdk_surface_is_input_only (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
return surface->input_only;
}
static void
update_cursor (GdkDisplay *display,
GdkDevice *device)
@ -2634,9 +2612,6 @@ gdk_surface_print (GdkSurface *surface,
g_print (" %s", surface_types[surface->surface_type]);
if (surface->input_only)
g_print (" input-only");
if (!gdk_surface_is_visible ((GdkSurface *)surface))
g_print (" hidden");
@ -2653,18 +2628,14 @@ gdk_surface_print (GdkSurface *surface,
static void
gdk_surface_print_tree (GdkSurface *surface,
int indent,
gboolean include_input_only)
int indent)
{
GList *l;
if (surface->input_only && !include_input_only)
return;
gdk_surface_print (surface, indent);
for (l = surface->children; l != NULL; l = l->next)
gdk_surface_print_tree (l->data, indent + 4, include_input_only);
gdk_surface_print_tree (l->data, indent + 4);
}
#endif /* DEBUG_SURFACE_PRINTING */
@ -2722,7 +2693,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
(event->key.keyval == 0xa7 ||
event->key.keyval == 0xbd))
{
gdk_surface_print_tree (event_surface, 0, event->key.keyval == 0xbd);
gdk_surface_print_tree (event_surface, 0);
}
#endif

View File

@ -528,8 +528,6 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_visible (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_viewable (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_input_only (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurfaceState gdk_surface_get_state (GdkSurface *surface);

View File

@ -1139,56 +1139,53 @@ move_resize_window_internal (GdkSurface *window,
}
else
{
if (!window->input_only)
NSRect nsrect;
nsrect = NSMakeRect (window->x, window->y, window->width, window->height);
/* The newly visible area of this window in a coordinate
* system rooted at the origin of this window.
*/
new_visible.x = -window->x;
new_visible.y = -window->y;
new_visible.width = old_visible.width; /* parent has not changed size */
new_visible.height = old_visible.height; /* parent has not changed size */
expose_region = cairo_region_create_rectangle (&new_visible);
old_region = cairo_region_create_rectangle (&old_visible);
cairo_region_subtract (expose_region, old_region);
/* Determine what (if any) part of the previously visible
* part of the window can be copied without a redraw
*/
scroll_rect = old_visible;
scroll_rect.x -= delta.width;
scroll_rect.y -= delta.height;
gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
if (!cairo_region_is_empty (expose_region))
{
NSRect nsrect;
nsrect = NSMakeRect (window->x, window->y, window->width, window->height);
/* The newly visible area of this window in a coordinate
* system rooted at the origin of this window.
*/
new_visible.x = -window->x;
new_visible.y = -window->y;
new_visible.width = old_visible.width; /* parent has not changed size */
new_visible.height = old_visible.height; /* parent has not changed size */
expose_region = cairo_region_create_rectangle (&new_visible);
old_region = cairo_region_create_rectangle (&old_visible);
cairo_region_subtract (expose_region, old_region);
/* Determine what (if any) part of the previously visible
* part of the window can be copied without a redraw
*/
scroll_rect = old_visible;
scroll_rect.x -= delta.width;
scroll_rect.y -= delta.height;
gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
if (!cairo_region_is_empty (expose_region))
if (scroll_rect.width != 0 && scroll_rect.height != 0)
{
if (scroll_rect.width != 0 && scroll_rect.height != 0)
{
[impl->view scrollRect:NSMakeRect (scroll_rect.x,
scroll_rect.y,
scroll_rect.width,
scroll_rect.height)
[impl->view scrollRect:NSMakeRect (scroll_rect.x,
scroll_rect.y,
scroll_rect.width,
scroll_rect.height)
by:delta];
}
[impl->view setFrame:nsrect];
gdk_quartz_surface_set_needs_display_in_region (window, expose_region);
}
else
{
[impl->view setFrame:nsrect];
[impl->view setNeedsDisplay:YES];
}
cairo_region_destroy (expose_region);
cairo_region_destroy (old_region);
[impl->view setFrame:nsrect];
gdk_quartz_surface_set_needs_display_in_region (window, expose_region);
}
else
{
[impl->view setFrame:nsrect];
[impl->view setNeedsDisplay:YES];
}
cairo_region_destroy (expose_region);
cairo_region_destroy (old_region);
}
GDK_QUARTZ_RELEASE_POOL;

View File

@ -127,7 +127,7 @@ _gdk_win32_surface_tmp_unset_bg (GdkSurface *window,
{
g_return_if_fail (GDK_IS_SURFACE (window));
if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
if (window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
return;
tmp_unset_bg (window);
@ -157,7 +157,7 @@ _gdk_win32_surface_tmp_reset_bg (GdkSurface *window,
{
g_return_if_fail (GDK_IS_SURFACE (window));
if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
if (window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
return;
tmp_reset_bg (window);

View File

@ -568,19 +568,7 @@ _gdk_win32_display_create_surface_impl (GdkDisplay *display,
impl->unscaled_width = window->width * impl->surface_scale;
impl->unscaled_height = window->height * impl->surface_scale;
if (!window->input_only)
{
dwExStyle = 0;
}
else
{
/* I very much doubt using WS_EX_TRANSPARENT actually
* corresponds to how X11 InputOnly windows work, but it appears
* to work well enough for the actual use cases in gtk.
*/
dwExStyle = WS_EX_TRANSPARENT;
GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n"));
}
dwExStyle = 0;
switch (window->surface_type)
{

View File

@ -717,16 +717,13 @@ setup_toplevel_window (GdkSurface *surface,
set_wm_protocols (surface);
if (!surface->input_only)
{
/* The focus surface is off the visible area, and serves to receive key
* press events so they don't get sent to child surfaces.
*/
toplevel->focus_window = create_focus_window (display, xid);
_gdk_x11_display_add_window (x11_screen->display,
&toplevel->focus_window,
surface);
}
/* The focus surface is off the visible area, and serves to receive key
* press events so they don't get sent to child surfaces.
*/
toplevel->focus_window = create_focus_window (display, xid);
_gdk_x11_display_add_window (x11_screen->display,
&toplevel->focus_window,
surface);
check_leader_window_title (x11_screen->display);
@ -858,48 +855,31 @@ _gdk_x11_display_create_surface_impl (GdkDisplay *display,
impl->override_redirect = FALSE;
if (!surface->input_only)
class = InputOutput;
xattributes.background_pixmap = None;
xattributes_mask |= CWBackPixmap;
xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
xattributes_mask |= CWBorderPixel;
xattributes.bit_gravity = NorthWestGravity;
xattributes_mask |= CWBitGravity;
xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
xattributes_mask |= CWColormap;
if (surface->surface_type == GDK_SURFACE_TEMP)
{
class = InputOutput;
xattributes.save_under = True;
xattributes.override_redirect = True;
xattributes.cursor = None;
xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
xattributes.background_pixmap = None;
xattributes_mask |= CWBackPixmap;
xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
xattributes_mask |= CWBorderPixel;
xattributes.bit_gravity = NorthWestGravity;
xattributes_mask |= CWBitGravity;
xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
xattributes_mask |= CWColormap;
if (surface->surface_type == GDK_SURFACE_TEMP)
{
xattributes.save_under = True;
xattributes.override_redirect = True;
xattributes.cursor = None;
xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
impl->override_redirect = TRUE;
}
depth = gdk_x11_display_get_window_depth (display_x11);
impl->override_redirect = TRUE;
}
else
{
class = InputOnly;
if (surface->surface_type == GDK_SURFACE_TEMP)
{
xattributes.override_redirect = True;
xattributes_mask |= CWOverrideRedirect;
impl->override_redirect = TRUE;
}
depth = 0;
}
depth = gdk_x11_display_get_window_depth (display_x11);
if (surface->width * impl->surface_scale > 32767 ||
surface->height * impl->surface_scale > 32767)