Always use the default screen

GDK doesn't support multiple screens, so effectively we don't either.
Lets stop pretending we do.

This fixes a few -Wdeprecated warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=769070
This commit is contained in:
Jonas Ådahl 2016-07-21 21:03:56 +08:00
parent 98cd8136ca
commit cd225c4e19
12 changed files with 37 additions and 49 deletions

View File

@ -920,11 +920,10 @@ meta_display_open (void)
display->compositor = NULL;
/* Mutter used to manage all X screens of the display in a single process, but
* now it always manages exactly one screen as specified by the DISPLAY
* environment variable.
* now it always manages exactly one screen - the default screen retrieved
* from GDK.
*/
i = meta_ui_get_screen_number ();
screen = meta_screen_new (display, i, timestamp);
screen = meta_screen_new (display, timestamp);
if (!screen)
{
@ -2640,7 +2639,7 @@ meta_display_unmanage_screen (MetaDisplay *display,
guint32 timestamp)
{
meta_verbose ("Unmanaging screen %d on display %s\n",
screen->number, display->name);
meta_ui_get_screen_number (), display->name);
meta_display_close (display, timestamp);
}

View File

@ -69,7 +69,6 @@ meta_window_ensure_frame (MetaWindow *window)
frame->rect.y,
frame->rect.width,
frame->rect.height,
frame->window->screen->number,
&create_serial);
frame->xwindow = frame->ui_frame->xwindow;

View File

@ -756,8 +756,8 @@ meta_window_place (MetaWindow *window,
x += xi->rect.x;
y += xi->rect.y;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on screen %d monitor %d\n",
window->desc, window->screen->number, xi->number);
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on monitor %d\n",
window->desc, xi->number);
goto done_check_denied_focus;
}

View File

@ -48,9 +48,7 @@ struct _MetaScreen
GObject parent_instance;
MetaDisplay *display;
int number;
char *screen_name;
Screen *xscreen;
Window xroot;
int default_depth;
Visual *default_xvisual;
@ -119,7 +117,6 @@ struct _MetaScreenClass
};
MetaScreen* meta_screen_new (MetaDisplay *display,
int number,
guint32 timestamp);
void meta_screen_free (MetaScreen *screen,
guint32 timestamp);

View File

@ -569,10 +569,11 @@ take_manager_selection (MetaDisplay *display,
MetaScreen*
meta_screen_new (MetaDisplay *display,
int number,
guint32 timestamp)
{
MetaScreen *screen;
int number;
Screen *xscreen;
Window xroot;
Display *xdisplay;
Window new_wm_sn_owner;
@ -583,6 +584,8 @@ meta_screen_new (MetaDisplay *display,
replace_current_wm = meta_get_replace_current_wm ();
number = meta_ui_get_screen_number ();
/* Only display->name, display->xdisplay, and display->error_traps
* can really be used in this function, since normally screens are
* created from the MetaDisplay constructor
@ -642,9 +645,7 @@ meta_screen_new (MetaDisplay *display,
screen->closing = 0;
screen->display = display;
screen->number = number;
screen->screen_name = get_screen_name (display, number);
screen->xscreen = ScreenOfDisplay (xdisplay, number);
screen->xroot = xroot;
screen->rect.x = screen->rect.y = 0;
@ -655,10 +656,10 @@ meta_screen_new (MetaDisplay *display,
meta_monitor_manager_get_screen_size (manager,
&screen->rect.width,
&screen->rect.height);
xscreen = ScreenOfDisplay (xdisplay, number);
screen->current_cursor = -1; /* invalid/unset */
screen->default_xvisual = DefaultVisualOfScreen (screen->xscreen);
screen->default_depth = DefaultDepthOfScreen (screen->xscreen);
screen->default_xvisual = DefaultVisualOfScreen (xscreen);
screen->default_depth = DefaultDepthOfScreen (xscreen);
screen->wm_sn_selection_window = new_wm_sn_owner;
screen->wm_sn_atom = wm_sn_atom;
@ -715,8 +716,7 @@ meta_screen_new (MetaDisplay *display,
screen->keys_grabbed = FALSE;
meta_screen_grab_keys (screen);
screen->ui = meta_ui_new (screen->display->xdisplay,
screen->xscreen);
screen->ui = meta_ui_new (screen->display->xdisplay);
screen->tile_preview_timeout_id = 0;
@ -726,7 +726,7 @@ meta_screen_new (MetaDisplay *display,
meta_prefs_add_listener (prefs_changed_callback, screen);
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
screen->number, screen->screen_name, screen->xroot);
number, screen->screen_name, screen->xroot);
return screen;
}
@ -793,7 +793,7 @@ meta_screen_free (MetaScreen *screen,
XSelectInput (screen->display->xdisplay, screen->xroot, 0);
if (meta_error_trap_pop_with_return (screen->display) != Success)
meta_warning ("Could not release screen %d on display \"%s\"\n",
screen->number, screen->display->name);
meta_ui_get_screen_number (), screen->display->name);
unset_wm_check_hint (screen);
@ -1956,8 +1956,7 @@ meta_screen_update_workspace_names (MetaScreen *screen)
screen->display->atom__NET_DESKTOP_NAMES,
&names, &n_names))
{
meta_verbose ("Failed to get workspace names from root window %d\n",
screen->number);
meta_verbose ("Failed to get workspace names from root window\n");
return;
}
@ -2656,7 +2655,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
int
meta_screen_get_screen_number (MetaScreen *screen)
{
return screen->number;
return meta_ui_get_screen_number ();
}
/**
@ -2712,7 +2711,8 @@ meta_screen_set_cm_selection (MetaScreen *screen)
guint32 timestamp;
timestamp = meta_display_get_current_time_roundtrip (screen->display);
g_snprintf (selection, sizeof (selection), "_NET_WM_CM_S%d", screen->number);
g_snprintf (selection, sizeof (selection), "_NET_WM_CM_S%d",
meta_ui_get_screen_number ());
a = XInternAtom (screen->display->xdisplay, selection, False);
screen->wm_cm_selection_window = take_manager_selection (screen->display, screen->xroot, a, timestamp, TRUE);
}

View File

@ -237,7 +237,7 @@ meta_stack_tracker_dump (MetaStackTracker *tracker)
{
GList *l;
meta_topic (META_DEBUG_STACK, "MetaStackTracker state (screen=%d)\n", tracker->screen->number);
meta_topic (META_DEBUG_STACK, "MetaStackTracker state\n");
meta_push_no_msg_prefix ();
meta_topic (META_DEBUG_STACK, " xserver_serial: %ld\n", tracker->xserver_serial);
meta_topic (META_DEBUG_STACK, " verified_stack: ");

View File

@ -675,7 +675,7 @@ meta_startup_notification_constructed (GObject *object)
sn_error_trap_pop);
sn->sn_context =
sn_monitor_context_new (sn->sn_display,
sn->display->screen->number,
meta_ui_get_screen_number (),
meta_startup_notification_sn_event,
sn,
NULL);

View File

@ -421,16 +421,11 @@ meta_ui_frame_calc_geometry (MetaUIFrame *frame,
}
MetaFrames*
meta_frames_new (int screen_number)
meta_frames_new (void)
{
GdkScreen *screen;
MetaFrames *frames;
screen = gdk_display_get_screen (gdk_display_get_default (),
screen_number);
frames = g_object_new (META_TYPE_FRAMES,
"screen", screen,
"type", GTK_WINDOW_POPUP,
NULL);

View File

@ -109,7 +109,7 @@ struct _MetaFramesClass
GType meta_frames_get_type (void) G_GNUC_CONST;
MetaFrames *meta_frames_new (int screen_number);
MetaFrames *meta_frames_new (void);
MetaUIFrame * meta_frames_manage_window (MetaFrames *frames,
MetaWindow *meta_window,

View File

@ -34,7 +34,6 @@
struct _MetaUI
{
Display *xdisplay;
Screen *xscreen;
MetaFrames *frames;
/* For double-click tracking */
@ -81,20 +80,18 @@ meta_ui_get_screen_number (void)
}
MetaUI*
meta_ui_new (Display *xdisplay,
Screen *screen)
meta_ui_new (Display *xdisplay)
{
GdkDisplay *gdisplay;
MetaUI *ui;
ui = g_new0 (MetaUI, 1);
ui->xdisplay = xdisplay;
ui->xscreen = screen;
gdisplay = gdk_x11_lookup_xdisplay (xdisplay);
g_assert (gdisplay == gdk_display_get_default ());
ui->frames = meta_frames_new (XScreenNumberOfScreen (screen));
ui->frames = meta_frames_new ();
/* GTK+ needs the frame-sync protocol to work in order to properly
* handle style changes. This means that the dummy widget we create
* to get the style for title bars actually needs to be mapped
@ -141,16 +138,17 @@ meta_ui_create_frame (MetaUI *ui,
gint y,
gint width,
gint height,
gint screen_no,
gulong *create_serial)
{
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
GdkScreen *screen = gdk_display_get_screen (display, screen_no);
GdkScreen *screen;
GdkWindowAttr attrs;
gint attributes_mask;
GdkWindow *window;
GdkVisual *visual;
screen = gdk_display_get_default_screen (display);
/* Default depth/visual handles clients with weird visuals; they can
* always be children of the root depth/visual obviously, but
* e.g. DRI games can't be children of a parent that has the same
@ -251,14 +249,16 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameFlags flags,
MetaFrameBorders *borders)
{
GdkDisplay *display;
GdkScreen *screen;
int text_height;
MetaStyleInfo *style_info = NULL;
PangoContext *context;
const PangoFontDescription *font_desc;
PangoFontDescription *free_font_desc = NULL;
GdkDisplay *display = gdk_x11_lookup_xdisplay (ui->xdisplay);
GdkScreen *screen = gdk_display_get_screen (display, XScreenNumberOfScreen (ui->xscreen));
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
screen = gdk_display_get_default_screen (display);
style_info = meta_theme_create_style_info (screen, NULL);

View File

@ -42,8 +42,7 @@ Display* meta_ui_get_display (void);
gint meta_ui_get_screen_number (void);
MetaUI* meta_ui_new (Display *xdisplay,
Screen *screen);
MetaUI* meta_ui_new (Display *xdisplay);
void meta_ui_free (MetaUI *ui);
void meta_ui_theme_get_frame_borders (MetaUI *ui,
@ -59,7 +58,6 @@ MetaUIFrame * meta_ui_create_frame (MetaUI *ui,
gint y,
gint width,
gint height,
gint screen_no,
gulong *create_serial);
void meta_ui_move_resize_frame (MetaUI *ui,
Window frame,

View File

@ -648,7 +648,7 @@ meta_spew_event (MetaDisplay *display,
meta_spew_core_event (display, event, &name, &extra);
if (event->xany.window == screen->xroot)
winname = g_strdup_printf ("root %d", screen->number);
winname = g_strdup_printf ("root");
else
winname = g_strdup_printf ("0x%lx", event->xany.window);
@ -1154,8 +1154,8 @@ process_selection_clear (MetaDisplay *display,
return FALSE;
}
meta_verbose ("Got selection clear for screen %d on display %s\n",
screen->number, display->name);
meta_verbose ("Got selection clear for on display %s\n",
display->name);
meta_display_unmanage_screen (display, display->screen,
event->xselectionclear.time);