From c53a08409aa19dbd30f5304fc7d34b4a6c3a92cf Mon Sep 17 00:00:00 2001 From: rbdpngn Date: Wed, 14 Jan 2004 23:08:58 +0000 Subject: [PATCH] The start of desktop change notification, added the ability to set the command used to launch a window (set in the defaults). SVN revision: 8429 --- legacy/ecore/src/lib/ecore_x/Ecore_X.h | 11 +++++++ legacy/ecore/src/lib/ecore_x/ecore_x.c | 4 +++ legacy/ecore/src/lib/ecore_x/ecore_x_events.c | 21 ++++++++++++- .../ecore/src/lib/ecore_x/ecore_x_private.h | 1 + legacy/ecore/src/lib/ecore_x/ecore_x_window.c | 5 ++++ .../src/lib/ecore_x/ecore_x_window_prop.c | 30 +++++++++++++++++++ 6 files changed, 71 insertions(+), 1 deletion(-) diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 48796bed78..53c2bf4c6a 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -120,6 +120,7 @@ typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change Ecore_X_Event typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change Ecore_X_Event_Window_Prop_Client_Machine_Change; typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change Ecore_X_Event_Window_Prop_Name_Class_Change; typedef struct _Ecore_X_Event_Window_Prop_Pid_Change Ecore_X_Event_Window_Prop_Pid_Change; +typedef struct _Ecore_X_Event_Window_Prop_Desktop_Change Ecore_X_Event_Window_Prop_Desktop_Change; struct _Ecore_X_Event_Key_Down { @@ -446,6 +447,13 @@ struct _Ecore_X_Event_Window_Prop_Pid_Change Ecore_X_Time time; }; +struct _Ecore_X_Event_Window_Prop_Desktop_Change +{ + Ecore_X_Window win; + long desktop; + Ecore_X_Time time; +}; + extern int ECORE_X_EVENT_KEY_DOWN; extern int ECORE_X_EVENT_KEY_UP; extern int ECORE_X_EVENT_MOUSE_BUTTON_DOWN; @@ -488,6 +496,7 @@ extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE; +extern int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE; extern int ECORE_X_MODIFIER_SHIFT; extern int ECORE_X_MODIFIER_CTRL; @@ -626,6 +635,8 @@ void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type); void ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t); char *ecore_x_window_prop_title_get(Ecore_X_Window win); +void ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv); +void ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv); void ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t); char *ecore_x_window_prop_visible_title_get(Ecore_X_Window win); void ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index 34c8e1fcdc..475d0713fb 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -32,6 +32,7 @@ Atom _ecore_x_atom_wm_take_focus = 0; Atom _ecore_x_atom_wm_protocols = 0; Atom _ecore_x_atom_wm_class = 0; Atom _ecore_x_atom_wm_name = 0; +Atom _ecore_x_atom_wm_command = 0; Atom _ecore_x_atom_wm_icon_name = 0; Atom _ecore_x_atom_wm_client_machine = 0; Atom _ecore_x_atom_motif_wm_hints = 0; @@ -151,6 +152,7 @@ int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0; +int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0; int ECORE_X_MODIFIER_SHIFT = 0; int ECORE_X_MODIFIER_CTRL = 0; @@ -274,6 +276,7 @@ ecore_x_init(const char *name) ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = ecore_event_type_new(); } ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); @@ -307,6 +310,7 @@ ecore_x_init(const char *name) _ecore_x_atom_wm_protocols = XInternAtom(_ecore_x_disp, "WM_PROTOCOLS", False); _ecore_x_atom_wm_class = XInternAtom(_ecore_x_disp, "WM_CLASS", False); _ecore_x_atom_wm_name = XInternAtom(_ecore_x_disp, "WM_NAME", False); + _ecore_x_atom_wm_command = XInternAtom(_ecore_x_disp, "WM_COMMAND", False); _ecore_x_atom_wm_icon_name = XInternAtom(_ecore_x_disp, "WM_ICON_NAME", False); _ecore_x_atom_wm_client_machine = XInternAtom(_ecore_x_disp, "WM_CLIENT_MACHINE", False); _ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c index 981f6c1025..c8e2c7c508 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c @@ -10,6 +10,7 @@ static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *e static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_pid_change(void *data, void *ev); +static void _ecore_x_event_free_window_prop_desktop_change(void *data, void *ev); static void _ecore_x_event_free_key_down(void *data, void *ev); static void _ecore_x_event_free_key_up(void *data, void *ev); static void _ecore_x_event_free_generic(void *data, void *ev); @@ -78,7 +79,16 @@ _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev) static void _ecore_x_event_free_window_prop_pid_change(void *data, void *ev) { - Ecore_X_Event_Window_Prop_Client_Machine_Change *e; + Ecore_X_Event_Window_Prop_Pid_Change *e; + + e = ev; + free(e); +} + +static void +_ecore_x_event_free_window_prop_desktop_change(void *data, void *ev) +{ + Ecore_X_Event_Window_Prop_Desktop_Change *e; e = ev; free(e); @@ -831,6 +841,15 @@ _ecore_x_event_handle_property_notify(XEvent *xevent) _ecore_x_event_last_time = e->time; ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, _ecore_x_event_free_window_prop_pid_change, NULL); } + else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_desktop) + { + Ecore_X_Event_Window_Prop_Desktop_Change *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change)); + if (!e) return; + e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window); + ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, _ecore_x_event_free_window_prop_desktop_change, NULL); + } else { Ecore_X_Event_Window_Property *e; diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h index e68bfd5c9d..c455ffe137 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h @@ -72,6 +72,7 @@ extern Atom _ecore_x_atom_wm_take_focus; extern Atom _ecore_x_atom_wm_protocols; extern Atom _ecore_x_atom_wm_class; extern Atom _ecore_x_atom_wm_name; +extern Atom _ecore_x_atom_wm_command; extern Atom _ecore_x_atom_wm_icon_name; extern Atom _ecore_x_atom_wm_client_machine; extern Atom _ecore_x_atom_motif_wm_hints; diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window.c index 9c69ef23fd..bbe63bca3c 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window.c @@ -180,6 +180,8 @@ ecore_x_window_defaults_set(Ecore_X_Window win) { long pid; char buf[MAXHOSTNAMELEN]; + int argc; + char **argv; /* * Set WM_CLIENT_MACHINE. @@ -197,6 +199,9 @@ ecore_x_window_defaults_set(Ecore_X_Window win) 32, &pid, 1); ecore_x_window_prop_window_type_normal_set(win); + + ecore_app_args_get(&argc, &argv); + ecore_x_window_prop_command_set(win, argc, argv); } /** diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c index 319750a28a..7f603986a7 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c @@ -216,6 +216,36 @@ ecore_x_window_prop_title_get(Ecore_X_Window win) return title; } +/** + * Set a window command. + * @param win The window + * @param t The command string + * + * Set a window command + *
















+ */ +void +ecore_x_window_prop_command_set(Ecore_X_Window win, int argc, char **argv) +{ + XSetCommand(_ecore_x_disp, win, argv, argc); +} + +/** + * Get a window command. + * @param win The window + * @return The windows command string + * + * Return the command of a window. String must be free'd when done with. + *
















+ */ +void +ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv) +{ + XGetCommand(_ecore_x_disp, win, argv, argc); +} + + + /** * Set a window visible title. * @param win The window