diff options
author | Victor Kareh <[email protected]> | 2024-04-05 14:04:58 -0400 |
---|---|---|
committer | lukefromdc <[email protected]> | 2024-06-18 17:04:23 -0400 |
commit | b7bf18ee00c1eb780f2f9c3732bfe07eefb726a8 (patch) | |
tree | 53dcf7918f5d0fc154b30c61528087ec95bdc905 | |
parent | feec46837ff27dc3ec2e3b98c6b2a9537b631c54 (diff) | |
download | marco-b7bf18ee00c1eb780f2f9c3732bfe07eefb726a8.tar.bz2 marco-b7bf18ee00c1eb780f2f9c3732bfe07eefb726a8.tar.xz |
window: Parse _GTK_APPLICATION_ID property
GTK+ has support for the application ID property. This will allow Marco
to reconstruct the path to the desktop spec file and so have access to
all internal attributes (e.g. name, icon, etc.)
-rw-r--r-- | src/core/atomnames.h | 1 | ||||
-rw-r--r-- | src/core/window-private.h | 1 | ||||
-rw-r--r-- | src/core/window-props.c | 25 | ||||
-rw-r--r-- | src/core/window.c | 5 |
4 files changed, 31 insertions, 1 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h index cea869d0..4b99f163 100644 --- a/src/core/atomnames.h +++ b/src/core/atomnames.h @@ -60,6 +60,7 @@ item(_MARCO_SET_KEYBINDINGS_MESSAGE) item(_MARCO_TOGGLE_VERBOSE) item(_GTK_THEME_VARIANT) item(_GTK_FRAME_EXTENTS) +item(_GTK_APPLICATION_ID) item(_GTK_SHOW_WINDOW_MENU) item(_GTK_WORKAREAS) item(_MATE_PANEL_ACTION) diff --git a/src/core/window-private.h b/src/core/window-private.h index 02b7df42..c6117654 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -133,6 +133,7 @@ struct _MetaWindow char *wm_client_machine; char *startup_id; char *gtk_theme_variant; + char *gtk_application_id; int net_wm_pid; diff --git a/src/core/window-props.c b/src/core/window-props.c index e1275817..fd08d33f 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1603,6 +1603,30 @@ reload_gtk_theme_variant (MetaWindow *window, meta_ui_update_frame_style (window->screen->ui, window->frame->xwindow); } } + +static void +reload_gtk_application_id (MetaWindow *window, + MetaPropValue *value, + gboolean initial) +{ + char *requested = NULL; + char *current = window->gtk_application_id; + + if (value->type != META_PROP_VALUE_INVALID) + { + requested = value->v.str; + meta_verbose ("Requested \"%s\" gtk-application-id for window %s.\n", + requested, window->desc); + } + + if (g_strcmp0 (requested, current) != 0) + { + g_free (current); + + window->gtk_application_id = g_strdup (requested); + } +} + /** * Initialises the property hooks system. Each row in the table named "hooks" * represents an action to take when a property is found on a newly-created @@ -1652,6 +1676,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) { display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window }, { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, }, { display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST, reload_gtk_frame_extents }, + { display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id }, { 0 }, }; diff --git a/src/core/window.c b/src/core/window.c index c1702dd8..658ca957 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -263,7 +263,7 @@ meta_window_new_with_attrs (MetaDisplay *display, gulong existing_wm_state; gulong event_mask; MetaMoveResizeFlags flags; -#define N_INITIAL_PROPS 20 +#define N_INITIAL_PROPS 21 Atom initial_props[N_INITIAL_PROPS]; int i; gboolean has_shape; @@ -563,6 +563,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->wm_client_machine = NULL; window->startup_id = NULL; window->gtk_theme_variant = NULL; + window->gtk_application_id = NULL; window->net_wm_pid = -1; @@ -621,6 +622,7 @@ meta_window_new_with_attrs (MetaDisplay *display, initial_props[i++] = display->atom__NET_WM_USER_TIME_WINDOW; initial_props[i++] = display->atom__NET_WM_FULLSCREEN_MONITORS; initial_props[i++] = display->atom__GTK_THEME_VARIANT; + initial_props[i++] = display->atom__GTK_APPLICATION_ID; g_assert (N_INITIAL_PROPS == i); meta_window_reload_properties (window, initial_props, N_INITIAL_PROPS, TRUE); @@ -9015,6 +9017,7 @@ meta_window_finalize (GObject *object) g_clear_pointer (&window->icon_name, g_free); g_clear_pointer (&window->desc, g_free); g_clear_pointer (&window->gtk_theme_variant, g_free); + g_clear_pointer (&window->gtk_application_id, g_free); G_OBJECT_CLASS (meta_window_parent_class)->finalize (object); } |