From 812140933f8f29e48ce8ae9f933b61fe84ae7336 Mon Sep 17 00:00:00 2001 From: rbdpngn Date: Sun, 12 Oct 2003 06:55:40 +0000 Subject: [PATCH] More NetWM support, this time added _NET_WM_VISIBLE_ICON_NAME. SVN revision: 7550 --- legacy/ecore/src/bin/ecore_test.c | 23 +++++++ legacy/ecore/src/lib/ecore_x/Ecore_X.h | 21 +++++-- legacy/ecore/src/lib/ecore_x/ecore_x.c | 62 ++++++++++--------- legacy/ecore/src/lib/ecore_x/ecore_x_events.c | 20 ++++++ .../ecore/src/lib/ecore_x/ecore_x_private.h | 1 + .../src/lib/ecore_x/ecore_x_window_prop.c | 32 ++++++++++ 6 files changed, 125 insertions(+), 34 deletions(-) diff --git a/legacy/ecore/src/bin/ecore_test.c b/legacy/ecore/src/bin/ecore_test.c index 7adba2f221..da4e448888 100644 --- a/legacy/ecore/src/bin/ecore_test.c +++ b/legacy/ecore/src/bin/ecore_test.c @@ -442,6 +442,19 @@ handler_x_window_prop_icon_name_change(void *data, int type, void *event) return 1; } +int +handler_x_window_prop_visible_icon_name_change(void *data, int type, void *event) +{ + Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e; + + e = event; + if (e->name) + printf("Visible icon name change to \"%s\"\n", e->name); + else + printf("Visible icon name deleted\n"); + return 1; +} + int handler_x_window_prop_name_class_change(void *data, int type, void *event) { @@ -483,6 +496,15 @@ setup_ecore_x_test(void) } printf("Icon Name: %s\n", tmp); free(tmp); + tmp = ecore_x_window_prop_visible_icon_name_get(win); + if (!tmp) + { + printf("No visible icon name, setting it to Ecore\n"); + ecore_x_window_prop_visible_icon_name_set(win, "Ecore"); + tmp = ecore_x_window_prop_visible_icon_name_get(win); + } + printf("Visible icon Name: %s\n", tmp); + free(tmp); ecore_x_window_prop_name_class_set(win, "ecore_test", "main"); ecore_x_window_prop_protocol_set(win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1); ecore_x_window_show(win); @@ -504,6 +526,7 @@ setup_ecore_x_test(void) ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, handler_x_window_prop_title_change, NULL); ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, handler_x_window_prop_visible_title_change, NULL); ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, handler_x_window_prop_icon_name_change, NULL); + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, handler_x_window_prop_visible_icon_name_change, NULL); ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, handler_x_window_prop_name_class_change, NULL); } #endif diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 8d3d541f08..eb1ac435db 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -99,11 +99,12 @@ typedef struct _Ecore_X_Event_Selection_Notify Ecore_X_Event_Selection_N typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message; typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape; -typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request; -typedef struct _Ecore_X_Event_Window_Prop_Title_Change Ecore_X_Event_Window_Prop_Title_Change; -typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change Ecore_X_Event_Window_Prop_Visible_Title_Change; -typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change Ecore_X_Event_Window_Prop_Icon_Name_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_Delete_Request Ecore_X_Event_Window_Delete_Request; +typedef struct _Ecore_X_Event_Window_Prop_Title_Change Ecore_X_Event_Window_Prop_Title_Change; +typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change Ecore_X_Event_Window_Prop_Visible_Title_Change; +typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change Ecore_X_Event_Window_Prop_Icon_Name_Change; +typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change; +typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change Ecore_X_Event_Window_Prop_Name_Class_Change; struct _Ecore_X_Event_Key_Down { @@ -385,6 +386,13 @@ struct _Ecore_X_Event_Window_Prop_Icon_Name_Change Ecore_X_Time time; }; +struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change +{ + Ecore_X_Window win; + char *name; + Ecore_X_Time time; +}; + struct _Ecore_X_Event_Window_Prop_Name_Class_Change { Ecore_X_Window win; @@ -431,6 +439,7 @@ extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST; extern int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE; +extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE; extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE; extern int ECORE_X_MODIFIER_SHIFT; @@ -515,6 +524,8 @@ void ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const 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); char *ecore_x_window_prop_icon_name_get(Ecore_X_Window win); +void ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t); +char *ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win); void ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const char *c); void ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n, char **c); void ecore_x_window_prop_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, int on); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index fe753a0465..0b7e7efb0e 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -38,6 +38,7 @@ Atom _ecore_x_atom_net_current_desktop = 0; Atom _ecore_x_atom_net_wm_name = 0; Atom _ecore_x_atom_net_wm_visible_name = 0; Atom _ecore_x_atom_net_wm_icon_name = 0; +Atom _ecore_x_atom_net_wm_visible_icon_name = 0; Atom _ecore_x_atom_net_wm_window_type = 0; Atom _ecore_x_atom_net_wm_state = 0; Atom _ecore_x_atom_net_wm_state_above = 0; @@ -94,6 +95,7 @@ int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0; +int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0; int ECORE_X_MODIFIER_SHIFT = 0; int ECORE_X_MODIFIER_CTRL = 0; @@ -209,11 +211,12 @@ ecore_x_init(const char *name) ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new(); } ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); @@ -242,30 +245,31 @@ ecore_x_init(const char *name) return 0; } _ecore_x_filter_handler = ecore_event_filter_add(_ecore_x_event_filter_start, _ecore_x_event_filter_filter, _ecore_x_event_filter_end, NULL); - _ecore_x_atom_wm_delete_window = XInternAtom(_ecore_x_disp, "WM_DELETE_WINDOW", False); - _ecore_x_atom_wm_take_focus = XInternAtom(_ecore_x_disp, "WM_TAKE_FOCUS", False); - _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_icon_name = XInternAtom(_ecore_x_disp, "WM_ICON_NAME", False); - _ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False); - _ecore_x_atom_win_layer = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False); - _ecore_x_atom_net_current_desktop = XInternAtom(_ecore_x_disp, "_NET_CURRENT_DESKTOP", False); - _ecore_x_atom_net_wm_name = XInternAtom(_ecore_x_disp, "_NET_WM_NAME", False); - _ecore_x_atom_net_wm_visible_name = XInternAtom(_ecore_x_disp, "_NET_WM_VISIBLE_NAME", False); - _ecore_x_atom_net_wm_icon_name = XInternAtom(_ecore_x_disp, "_NET_WM_ICON_NAME", False); - _ecore_x_atom_net_wm_desktop = XInternAtom(_ecore_x_disp, "_NET_WM_DESKTOP", False); - _ecore_x_atom_net_wm_window_type = XInternAtom(_ecore_x_disp, "_NET_WM_WINDOW_TYPE", False); - _ecore_x_atom_net_wm_state = XInternAtom(_ecore_x_disp, "_NET_WM_STATE", False); - _ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_ABOVE", False); - _ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_BELOW", False); - _ecore_x_atom_net_wm_allowed_actions = XInternAtom(_ecore_x_disp, "_NET_WM_ALLOWED_ACTIONS", False); - _ecore_x_atom_net_wm_strut = XInternAtom(_ecore_x_disp, "_NET_WM_STRUT", False); - _ecore_x_atom_net_wm_strut_partial = XInternAtom(_ecore_x_disp, "_NET_WM_STRUT_PARTIAL", False); - _ecore_x_atom_net_wm_icon_geometry = XInternAtom(_ecore_x_disp, "_NET_WM_ICON_GEOMETRY", False); - _ecore_x_atom_net_wm_icon = XInternAtom(_ecore_x_disp, "_NET_WM_ICON", False); - _ecore_x_atom_net_wm_pid = XInternAtom(_ecore_x_disp, "_NET_WM_PID", False); - _ecore_x_atom_net_wm_user_time = XInternAtom(_ecore_x_disp, "_NET_WM_USER_TIME", False); + _ecore_x_atom_wm_delete_window = XInternAtom(_ecore_x_disp, "WM_DELETE_WINDOW", False); + _ecore_x_atom_wm_take_focus = XInternAtom(_ecore_x_disp, "WM_TAKE_FOCUS", False); + _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_icon_name = XInternAtom(_ecore_x_disp, "WM_ICON_NAME", False); + _ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False); + _ecore_x_atom_win_layer = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False); + _ecore_x_atom_net_current_desktop = XInternAtom(_ecore_x_disp, "_NET_CURRENT_DESKTOP", False); + _ecore_x_atom_net_wm_name = XInternAtom(_ecore_x_disp, "_NET_WM_NAME", False); + _ecore_x_atom_net_wm_visible_name = XInternAtom(_ecore_x_disp, "_NET_WM_VISIBLE_NAME", False); + _ecore_x_atom_net_wm_icon_name = XInternAtom(_ecore_x_disp, "_NET_WM_ICON_NAME", False); + _ecore_x_atom_net_wm_visible_icon_name = XInternAtom(_ecore_x_disp, "_NET_WM_VISIBLE_ICON_NAME", False); + _ecore_x_atom_net_wm_desktop = XInternAtom(_ecore_x_disp, "_NET_WM_DESKTOP", False); + _ecore_x_atom_net_wm_window_type = XInternAtom(_ecore_x_disp, "_NET_WM_WINDOW_TYPE", False); + _ecore_x_atom_net_wm_state = XInternAtom(_ecore_x_disp, "_NET_WM_STATE", False); + _ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_ABOVE", False); + _ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp, "_NET_WM_STATE_BELOW", False); + _ecore_x_atom_net_wm_allowed_actions = XInternAtom(_ecore_x_disp, "_NET_WM_ALLOWED_ACTIONS", False); + _ecore_x_atom_net_wm_strut = XInternAtom(_ecore_x_disp, "_NET_WM_STRUT", False); + _ecore_x_atom_net_wm_strut_partial = XInternAtom(_ecore_x_disp, "_NET_WM_STRUT_PARTIAL", False); + _ecore_x_atom_net_wm_icon_geometry = XInternAtom(_ecore_x_disp, "_NET_WM_ICON_GEOMETRY", False); + _ecore_x_atom_net_wm_icon = XInternAtom(_ecore_x_disp, "_NET_WM_ICON", False); + _ecore_x_atom_net_wm_pid = XInternAtom(_ecore_x_disp, "_NET_WM_PID", False); + _ecore_x_atom_net_wm_user_time = XInternAtom(_ecore_x_disp, "_NET_WM_USER_TIME", False); _ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", 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 b620217685..655179a1c5 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c @@ -6,6 +6,7 @@ static void _ecore_x_event_free_window_prop_name_class_change(void *data, void * static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev); +static void _ecore_x_event_free_window_prop_visible_icon_name_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); @@ -65,6 +66,16 @@ _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev) free(e); } +static void +_ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev) +{ + Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e; + + e = ev; + if (e->name) free(e->name); + free(e); +} + static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev) { @@ -752,6 +763,15 @@ _ecore_x_event_handle_property_notify(XEvent *xevent) e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL); } + else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_visible_icon_name) + { + Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change)); + if (!e) return; + e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window); + ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_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 279005232e..27e4a17333 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h @@ -68,6 +68,7 @@ extern Atom _ecore_x_atom_net_wm_state_below; extern Atom _ecore_x_atom_net_wm_name; extern Atom _ecore_x_atom_net_wm_visible_name; extern Atom _ecore_x_atom_net_wm_icon_name; +extern Atom _ecore_x_atom_net_wm_visible_icon_name; extern Atom _ecore_x_atom_net_wm_desktop; extern Atom _ecore_x_atom_net_wm_window_type; extern Atom _ecore_x_atom_net_wm_state; 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 09feb975c9..bd0285d25e 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 @@ -244,6 +244,38 @@ ecore_x_window_prop_icon_name_get(Ecore_X_Window win) return name; } +/** + * Set a window visible icon name. + * @param win The window + * @param t The visible icon name string + * + * Set a window visible icon name + *
















+ */ +void +ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t) +{ + ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_visible_icon_name, + (char *)t); +} + +/** + * Get a window visible icon name. + * @param win The window + * @return The windows visible icon name string + * + * Return the visible icon name of a window. String must be free'd when done with. + *
















+ */ +char * +ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win) +{ + char *name; + + name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_visible_icon_name); + return name; +} + /** * Set a window name & class. * @param win The window