Commit e834dfd6 authored by Victor Ananjevsky's avatar Victor Ananjevsky

implement --window-type option

parent 89a49795
......@@ -216,9 +216,18 @@ Run dialog window maximized.
.B \-\-fullscreen
Run dialog in fullscreen mode. This option may not work on all window managers.
.TP
.B \-\-splash
.B \-\-splash (Deprecated)
Open window with "splashscreen" window hints. For details see description of \fI_NET_WM_WINDOW_TYPE_SPLASH\fP
in EWMH specification. The behavior of dialog with this option is HIGHLY DEPENDS on settings of your window manager.
This option is deprecated. Use \fB--window-type\fP instead.
.TP
.B \-\-window-type=\fITYPE\fP
Create a window with the specified window type. \fITYPE\fPCan be one of \fInormal\fP, \fIdialog\fP, \fIutility\fP,
\fIdock\fP, \fIdesktop\fP, \fItooltip\fP, \fInotification\fP or \fIsplash\fP.
The behavior of each window type depends on your window manager. See EWMH specification for details.
\fINOTE:\fP Tiling window managers will often float a "dialog" window but tile a "normal" window.
.TP
.B \-\-no-focus
Dialog window never take focus.
......
......@@ -403,8 +403,12 @@ create_dialog (void)
/* create dialog window */
dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
#ifdef DEPRECATED
if (options.data.splash)
gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
options.data.window_type = GDK_WINDOW_TYPE_HINT_SPLASHSCREEN;
#endif
gtk_window_set_type_hint (GTK_WINDOW (dlg), options.data.window_type);
gtk_window_set_title (GTK_WINDOW (dlg), options.data.dialog_title);
gtk_widget_set_name (dlg, "yad-dialog-window");
......@@ -778,6 +782,15 @@ main (gint argc, gchar ** argv)
g_printerr (_("Unable to parse command line: %s\n"), err->message);
return -1;
}
#ifdef DEPRECATED
if (options.data.splash)
{
if (options.debug)
g_printerr(_("WARNING: Using splash option is deprecated, please use --window-type instead"));
}
#endif
yad_set_mode ();
/* set working directory */
......
......@@ -57,6 +57,7 @@ static gboolean set_scroll_policy (const gchar *, const gchar *, gpointer, GErro
static gboolean set_size_format (const gchar *, const gchar *, gpointer, GError **);
#endif
static gboolean set_interp (const gchar *, const gchar *, gpointer, GError **);
static gboolean set_window_type (const gchar * option_name, const gchar * value, gpointer data, GError ** err);
#ifdef HAVE_SOURCEVIEW
static gboolean set_right_margin (const gchar *, const gchar *, gpointer, GError **);
static gboolean set_smart_homend (const gchar *, const gchar *, gpointer, GError **);
......@@ -172,8 +173,12 @@ static GOptionEntry general_options[] = {
N_("Don't focus dialog window"), NULL },
{ "close-on-unfocus", 0, 0, G_OPTION_ARG_NONE, &options.data.close_on_unfocus,
N_("Close window when it sets unfocused"), NULL },
#ifdef DEPRECATED
{ "splash", 0, 0, G_OPTION_ARG_NONE, &options.data.splash,
N_("Open window as a splashscreen"), NULL },
N_("Open window as a splashscreen (Deprecated, see man page for details)"), NULL },
#endif
{ "window-type", 0, 0, G_OPTION_ARG_CALLBACK, set_window_type,
N_("Specify the window type for the dialog"), N_("TYPE") },
{ "plug", 0, 0, G_OPTION_ARG_INT, &options.plug,
N_("Special type of dialog for XEMBED"), N_("KEY") },
{ "tabnum", 0, 0, G_OPTION_ARG_INT, &options.tabnum,
......@@ -1373,6 +1378,31 @@ set_interp (const gchar * option_name, const gchar * value, gpointer data, GErro
return TRUE;
}
static gboolean
set_window_type (const gchar * option_name, const gchar * value, gpointer data, GError ** err)
{
if (strcasecmp (value, "normal") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_NORMAL;
else if (strcasecmp (value, "dialog") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_DIALOG;
else if (strcasecmp (value, "utility") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_UTILITY;
else if (strcasecmp (value, "dock") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_DOCK;
else if (strcasecmp (value, "desktop") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_DESKTOP;
else if (strcasecmp (value, "tooltip") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_TOOLTIP;
else if (strcasecmp (value, "notification") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_NOTIFICATION;
else if (strcasecmp (value, "splash") == 0)
options.data.window_type = GDK_WINDOW_TYPE_HINT_SPLASHSCREEN;
else
g_printerr (_("Unknown window type: %s\n"), value);
return TRUE;
}
#if HAVE_SOURCEVIEW
static gboolean
set_right_margin (const gchar * option_name, const gchar * value, gpointer data, GError ** err)
......@@ -1650,7 +1680,10 @@ yad_options_init (void)
options.data.skip_taskbar = FALSE;
options.data.maximized = FALSE;
options.data.fullscreen = FALSE;
#ifdef DEPRECATED
options.data.splash = FALSE;
#endif
options.data.window_type = GDK_WINDOW_TYPE_HINT_NORMAL;
options.data.focus = TRUE;
options.data.close_on_unfocus = FALSE;
......
......@@ -268,7 +268,10 @@ typedef struct {
gboolean skip_taskbar;
gboolean maximized;
gboolean fullscreen;
#ifdef DEPRECATED
gboolean splash;
#endif
GdkWindowTypeHint window_type;
gboolean focus;
gboolean close_on_unfocus;
} YadData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment