summaryrefslogtreecommitdiff
path: root/gdk/gdk.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2015-04-10 17:18:50 +0200
committerMatthias Clasen <mclasen@redhat.com>2015-05-10 22:40:37 -0400
commita8e5cacb911077c1b16a5d9bfc7589dd8b056a5d (patch)
treeaa02f86aa187cd95fd25219a1f161acddc36be0f /gdk/gdk.c
parent9d921ec148bc91ef5e290250d6be5cb2177de957 (diff)
downloadgtk+-a8e5cacb911077c1b16a5d9bfc7589dd8b056a5d.tar.gz
Allow overriding WM_CLASS from the command line
Even when the program itself calls gdk_set_program_class(). There's currently no way for this function to be called without breaking gdk's --class command line option, because you cannot call it before gtk_init(). https://bugzilla.gnome.org/show_bug.cgi?id=747634
Diffstat (limited to 'gdk/gdk.c')
-rw-r--r--gdk/gdk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 068ecc4f4c..d86ea85804 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -130,6 +130,7 @@ static int gdk_initialized = 0; /* 1 if the library is initi
*/
static gchar *gdk_progclass = NULL;
+static gboolean gdk_progclass_overridden;
static GMutex gdk_threads_mutex;
@@ -208,6 +209,7 @@ static gboolean
gdk_arg_class_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
gdk_set_program_class (value);
+ gdk_progclass_overridden = TRUE;
return TRUE;
}
@@ -1025,10 +1027,16 @@ gdk_get_program_class (void)
* Sets the program class. The X11 backend uses the program class to set
* the class name part of the `WM_CLASS` property on
* toplevel windows; see the ICCCM.
+ *
+ * The program class can still be overridden with the --class command
+ * line option.
*/
void
gdk_set_program_class (const char *program_class)
{
+ if (gdk_progclass_overridden)
+ return;
+
g_free (gdk_progclass);
gdk_progclass = g_strdup (program_class);