Drop the --screen cmdline argument

Commandline arguments should go away altogether, but this one
goes first, since we then don't need to worry about
_gdk_windowing_substitute_screen_number anymore.
This commit is contained in:
Matthias Clasen 2010-12-14 22:32:47 -05:00
parent beaa11be98
commit 5eb4506b94
4 changed files with 8 additions and 64 deletions

View File

@ -44,25 +44,7 @@ arguments.
<para>
The name of the X display to open instead of the one specified
in the <envar>DISPLAY</envar> environment variable.
</para>
</formalpara>
<formalpara>
<title><systemitem>--screen <replaceable>screen_number</replaceable></systemitem></title>
<para>
The number of the screen within the default display. This overrides
any screen number specified in the display name specified by
by he <systemitem>--display</systemitem> command line option or
the <envar>DISPLAY</envar> environment variable. If this screen
cannot be opened, then GTK+ will fall back to the screen
specified in the display name. This option is not useful
interactively; the intended purposes is that when a program
registers its command line with a <firstterm>session
manager</firstterm> for later restarting, it can save the
screen it is on, without having to worry if it might be
restarted on a different display.
in the <envar>DISPLAY</envar> environment variable.
</para>
</formalpara>
@ -70,7 +52,7 @@ in the <envar>DISPLAY</envar> environment variable.
<title><systemitem>--sync</systemitem></title>
<para>
Makes all X requests synchronously. This is a useful option for
Makes all X requests synchronously. This is a useful option for
debugging, but it will slow down the performance considerably.
</para>
</formalpara>

View File

@ -168,9 +168,6 @@ static const GOptionEntry gdk_args[] = {
{ "display", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &_gdk_display_name,
/* Description of --display=DISPLAY in --help output */ N_("X display to use"),
/* Placeholder in --display=DISPLAY in --help output */ N_("DISPLAY") },
{ "screen", 0, 0, G_OPTION_ARG_INT, &_gdk_screen_number,
/* Description of --screen=SCREEN in --help output */ N_("X screen to use"),
/* Placeholder in --screen=SCREEN in --help output */ N_("SCREEN") },
#ifdef G_ENABLE_DEBUG
{ "gdk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_debug_cb,
/* Description of --gdk-debug=FLAGS in --help output */ N_("GDK debugging flags to set"),
@ -296,12 +293,7 @@ G_CONST_RETURN gchar *
gdk_get_display_arg_name (void)
{
if (!_gdk_display_arg_name)
{
if (_gdk_screen_number >= 0)
_gdk_display_arg_name = _gdk_windowing_substitute_screen_number (_gdk_display_name, _gdk_screen_number);
else
_gdk_display_arg_name = g_strdup (_gdk_display_name);
}
_gdk_display_arg_name = g_strdup (_gdk_display_name);
return _gdk_display_arg_name;
}
@ -331,14 +323,6 @@ gdk_display_open_default_libgtk_only (void)
display = gdk_display_open (gdk_get_display_arg_name ());
if (!display && _gdk_screen_number >= 0)
{
g_free (_gdk_display_arg_name);
_gdk_display_arg_name = g_strdup (_gdk_display_name);
display = gdk_display_open (_gdk_display_name);
}
return display;
}

View File

@ -35,7 +35,6 @@
guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;
gchar *_gdk_display_name = NULL;
gint _gdk_screen_number = -1;
gchar *_gdk_display_arg_name = NULL;
gboolean _gdk_native_windows = FALSE;
gboolean _gdk_disable_multidevice = FALSE;

View File

@ -959,34 +959,13 @@ _gdk_x11_screen_process_owner_change (GdkScreen *screen,
#endif
}
/**
* _gdk_windowing_substitute_screen_number:
* @display_name: The name of a display, in the form used by
* gdk_display_open (). If %NULL a default value
* will be used. On X11, this is derived from the DISPLAY
* environment variable.
* @screen_number: The number of a screen within the display
* referred to by @display_name.
*
* Modifies a @display_name to make @screen_number the default
* screen when the display is opened.
*
* Return value: a newly allocated string holding the resulting
* display name. Free with g_free().
*/
gchar *
_gdk_windowing_substitute_screen_number (const gchar *display_name,
gint screen_number)
static gchar *
substitute_screen_number (const gchar *display_name,
gint screen_number)
{
GString *str;
gchar *p;
if (!display_name)
display_name = getenv ("DISPLAY");
if (!display_name)
return NULL;
str = g_string_new (display_name);
p = strrchr (str->str, '.');
@ -1007,8 +986,8 @@ gdk_screen_x11_make_display_name (GdkScreen *screen)
old_display = gdk_display_get_name (gdk_screen_get_display (screen));
return _gdk_windowing_substitute_screen_number (old_display,
gdk_screen_get_number (screen));
return substitute_screen_number (old_display,
gdk_screen_get_number (screen));
}
static GdkWindow *