More NetWM support, this time added _NET_WM_VISIBLE_ICON_NAME.

SVN revision: 7550
This commit is contained in:
rbdpngn 2003-10-12 06:55:40 +00:00 committed by rbdpngn
parent d0929d87e8
commit 812140933f
6 changed files with 125 additions and 34 deletions

View File

@ -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

View File

@ -103,6 +103,7 @@ typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Win
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);

View File

@ -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;
@ -214,6 +216,7 @@ ecore_x_init(const char *name)
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);
@ -254,6 +257,7 @@ ecore_x_init(const char *name)
_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);

View File

@ -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;

View File

@ -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;

View File

@ -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
* <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
*/
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.
* <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
*/
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