Drop gdk_window_get_screen

This includes removing the GdkScreen argument from the
create_window_impl display vfunc.
This commit is contained in:
Matthias Clasen 2017-10-31 17:23:15 -04:00
parent 85e209a9c3
commit 2d6bd1ae6d
18 changed files with 26 additions and 64 deletions

View File

@ -254,7 +254,6 @@ void
_gdk_broadway_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{

View File

@ -1655,14 +1655,12 @@ void
_gdk_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{
GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
window,
real_parent,
screen,
event_mask,
attributes);
}

View File

@ -169,7 +169,6 @@ struct _GdkDisplayClass
void (*create_window_impl) (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
@ -283,7 +282,6 @@ void _gdk_display_event_data_free (GdkDisplay *display
void _gdk_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
GdkWindow * _gdk_display_create_window (GdkDisplay *display);

View File

@ -977,19 +977,13 @@ gdk_window_new (GdkDisplay *display,
GdkWindowAttr *attributes)
{
GdkWindow *window;
GdkScreen *screen;
gboolean native;
GdkEventMask event_mask;
g_return_val_if_fail (attributes != NULL, NULL);
if (!parent)
{
screen = gdk_display_get_default_screen (display);
parent = gdk_screen_get_root_window (screen);
}
else
screen = gdk_window_get_screen (parent);
parent = gdk_screen_get_root_window (gdk_display_get_default_screen (display));
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
@ -1093,7 +1087,7 @@ gdk_window_new (GdkDisplay *display,
event_mask = get_native_event_mask (window);
/* Create the impl */
_gdk_display_create_window_impl (display, window, parent, screen, event_mask, attributes);
_gdk_display_create_window_impl (display, window, parent, event_mask, attributes);
window->impl_window = window;
}
else
@ -1377,7 +1371,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
return;
display = gdk_window_get_display (window);
screen = gdk_window_get_screen (window);
screen = gdk_display_get_default_screen (display);
temp_window = g_object_get_qdata (G_OBJECT (screen), quark_pointer_window);
if (temp_window == window)
g_object_set_qdata (G_OBJECT (screen), quark_pointer_window, NULL);
@ -1583,24 +1577,6 @@ gdk_window_get_window_type (GdkWindow *window)
return GDK_WINDOW_TYPE (window);
}
/**
* gdk_window_get_screen:
* @window: a #GdkWindow
*
* Gets the #GdkScreen associated with a #GdkWindow.
*
* Returns: (transfer none): the #GdkScreen associated with @window
*
* Since: 2.24
**/
GdkScreen*
gdk_window_get_screen (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
return gdk_display_get_default_screen (window->display);
}
/**
* gdk_window_get_display:
* @window: a #GdkWindow

View File

@ -421,8 +421,6 @@ GdkWindowType gdk_window_get_window_type (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
gboolean gdk_window_is_destroyed (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
GdkScreen * gdk_window_get_screen (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_window_get_display (GdkWindow *window);
GDK_AVAILABLE_IN_ALL

View File

@ -474,7 +474,6 @@ static void
gdk_mir_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{

View File

@ -734,7 +734,6 @@ void
_gdk_quartz_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{

View File

@ -139,7 +139,6 @@ void gdk_wayland_drop_context_update_targets (GdkDragContext *context);
void _gdk_wayland_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes);

View File

@ -655,7 +655,6 @@ void
_gdk_wayland_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{
@ -709,7 +708,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
g_signal_connect (frame_clock, "after-paint",
G_CALLBACK (on_frame_clock_after_paint), window);
g_signal_connect (screen, "monitors-changed",
g_signal_connect (gdk_display_get_default_screen (display), "monitors-changed",
G_CALLBACK (on_monitors_changed), window);
}
@ -1501,7 +1500,7 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window)
struct wl_output *fullscreen_output = NULL;
if (impl->initial_fullscreen_monitor >= 0 &&
impl->initial_fullscreen_monitor < gdk_display_get_n_monitors (display))
fullscreen_output = _gdk_wayland_screen_get_wl_output (gdk_window_get_screen (window), impl->initial_fullscreen_monitor);
fullscreen_output = _gdk_wayland_screen_get_wl_output (gdk_display_get_default_screen (gdk_window_get_display (window)), impl->initial_fullscreen_monitor);
impl->display_server.xdg_surface =
zxdg_shell_v6_get_xdg_surface (display_wayland->xdg_shell,
@ -3326,7 +3325,8 @@ static void
gdk_wayland_window_fullscreen_on_monitor (GdkWindow *window, gint monitor)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkScreen *screen = gdk_window_get_screen (window);
GdkDisplay *display = gdk_window_get_display (window);
GdkScreen *screen = gdk_display_get_default_screen (display);
struct wl_output *fullscreen_output =
_gdk_wayland_screen_get_wl_output (screen, monitor);

View File

@ -686,7 +686,6 @@ void
_gdk_win32_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{

View File

@ -244,7 +244,7 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
GdkWindow *root_window;
gint root_x, root_y;
root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
root_window = gdk_screen_get_root_window (gdk_display_get_default_screen (gdk_window_get_display (window)));
/* FIXME: Maybe root coords chaching should happen here */
gdk_window_get_origin (window, &root_x, &root_y);
_gdk_device_translate_screen_coord (device, window,

View File

@ -808,7 +808,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
return;
had_focus = HAS_FOCUS (toplevel);
x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (window));
x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (window));
switch (detail)
{

View File

@ -2678,7 +2678,7 @@ drag_context_grab (GdkDragContext *context)
if (!x11_context->ipc_window)
return FALSE;
root = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
root = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
seat = gdk_device_get_seat (gdk_drag_context_get_device (context));
#ifdef XINPUT_2
@ -2767,7 +2767,7 @@ drag_context_ungrab (GdkDragContext *context)
gdk_seat_ungrab (x11_context->grab_seat);
keyboard = gdk_seat_get_keyboard (x11_context->grab_seat);
root = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
root = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
g_clear_object (&x11_context->grab_seat);
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
@ -3030,7 +3030,7 @@ gdk_dnd_handle_key_event (GdkDragContext *context,
* to query it here. We could use XGetModifierMapping, but
* that would be overkill.
*/
root_window = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
root_window = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
gdk_window_get_device_position (root_window, pointer, NULL, NULL, &state);
if (dx != 0 || dy != 0)

View File

@ -136,7 +136,7 @@ handle_focus_change (GdkEventCrossing *event)
gboolean focus_in, had_focus;
toplevel = _gdk_x11_window_get_toplevel (event->window);
x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->window));
x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (event->window));
focus_in = (event->type == GDK_ENTER_NOTIFY);
if (x11_screen->wmspec_check_window)

View File

@ -1209,7 +1209,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
display = gdk_window_get_display (window);
if (!gdk_x11_screen_init_gl (gdk_window_get_screen (window)))
if (!gdk_x11_screen_init_gl (GDK_WINDOW_SCREEN (window)))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,

View File

@ -250,7 +250,6 @@ void _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
void _gdk_x11_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
@ -297,7 +296,7 @@ extern const gint _gdk_x11_event_mask_table_size;
#define GDK_SCREEN_DISPLAY(screen) (GDK_X11_SCREEN (screen)->display)
#define GDK_SCREEN_XROOTWIN(screen) (GDK_X11_SCREEN (screen)->xroot_window)
#define GDK_WINDOW_SCREEN(win) (gdk_window_get_screen (win))
#define GDK_WINDOW_SCREEN(win) (gdk_display_get_default_screen (gdk_window_get_display (win)))
#define GDK_WINDOW_DISPLAY(win) (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->display)
#define GDK_WINDOW_XROOTWIN(win) (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->xroot_window)
#define GDK_GC_DISPLAY(gc) (GDK_SCREEN_DISPLAY (GDK_GC_X11(gc)->screen))

View File

@ -437,7 +437,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
impl->toplevel->current_counter_value);
if (impl->frame_sync_enabled &&
gdk_x11_screen_supports_net_wm_hint (gdk_window_get_screen (window),
gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_FRAME_DRAWN")))
{
impl->toplevel->frame_pending = TRUE;
@ -904,7 +904,6 @@ void
_gdk_x11_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
{
@ -925,7 +924,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
display_x11 = GDK_X11_DISPLAY (display);
xparent = GDK_WINDOW_XID (real_parent);
x11_screen = GDK_X11_SCREEN (screen);
x11_screen = GDK_X11_SCREEN (gdk_display_get_default_screen (display));
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
window->impl = GDK_WINDOW_IMPL (impl);
@ -948,7 +947,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
{
/* The common code warns for this case */
xparent = GDK_SCREEN_XROOTWIN (screen);
xparent = GDK_SCREEN_XROOTWIN (x11_screen);
}
break;

View File

@ -74,7 +74,7 @@ struct _GtkIMContextXIM
struct _GtkXIMInfo
{
GdkScreen *screen;
GdkDisplay *display;
XIM im;
char *locale;
XIMStyle preedit_style_setting;
@ -310,7 +310,7 @@ setup_im (GtkXIMInfo *info)
setup_styles (info);
reinitialize_all_ics (info);
display = gdk_screen_get_display (info->screen);
display = info->display;
info->display_closed_cb = g_signal_connect (display, "closed",
G_CALLBACK (xim_info_display_closed), info);
}
@ -374,8 +374,7 @@ xim_instantiate_callback (Display *display, XPointer client_data,
static void
xim_info_try_im (GtkXIMInfo *info)
{
GdkScreen *screen = info->screen;
GdkDisplay *display = gdk_screen_get_display (screen);
GdkDisplay *display = info->display;
g_assert (info->im == NULL);
if (info->reconnecting)
@ -424,14 +423,14 @@ get_im (GdkWindow *client_window,
{
GSList *tmp_list;
GtkXIMInfo *info;
GdkScreen *screen = gdk_window_get_screen (client_window);
GdkDisplay *display = gdk_window_get_display (client_window);
info = NULL;
tmp_list = open_ims;
while (tmp_list)
{
GtkXIMInfo *tmp_info = tmp_list->data;
if (tmp_info->screen == screen &&
if (tmp_info->display == display &&
strcmp (tmp_info->locale, locale) == 0)
{
if (tmp_info->im)
@ -452,7 +451,7 @@ get_im (GdkWindow *client_window,
info = g_new (GtkXIMInfo, 1);
open_ims = g_slist_prepend (open_ims, info);
info->screen = screen;
info->display = display;
info->locale = g_strdup (locale);
info->xim_styles = NULL;
info->preedit_style_setting = 0;
@ -512,7 +511,7 @@ gtk_im_context_xim_finalize (GObject *obj)
{
GdkDisplay *display;
display = gdk_screen_get_display (context_xim->im_info->screen);
display = context_xim->im_info->display;
XUnregisterIMInstantiateCallback (GDK_DISPLAY_XDISPLAY (display),
NULL, NULL, NULL,
xim_instantiate_callback,
@ -1787,7 +1786,7 @@ gtk_im_context_xim_shutdown (void)
while (open_ims)
{
GtkXIMInfo *info = open_ims->data;
GdkDisplay *display = gdk_screen_get_display (info->screen);
GdkDisplay *display = info->display;
xim_info_display_closed (display, FALSE, info);
open_ims = g_slist_remove_link (open_ims, open_ims);