From a4142082664d9ca5c923343623620acc4fc3ba85 Mon Sep 17 00:00:00 2001 From: raster Date: Thu, 28 Oct 2010 00:32:43 +0000 Subject: [PATCH] ecore_x -> add mapping change event for when key/pointer/modifier mappings change (xmodmap or kbd layout change). fix other events to have proper eina_bool too and enums also remove already disabled old unimplemented events commented out. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@53942 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/Ecore_X.h | 192 ++++++++----------------- src/lib/ecore_x/xcb/ecore_xcb.c | 23 +-- src/lib/ecore_x/xcb/ecore_xcb_events.c | 195 ------------------------- src/lib/ecore_x/xlib/ecore_x.c | 23 +-- src/lib/ecore_x/xlib/ecore_x_events.c | 255 ++++----------------------------- 5 files changed, 94 insertions(+), 594 deletions(-) diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 1588107..7ac0f53 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -299,6 +299,19 @@ typedef enum _Ecore_X_Shape_Type ECORE_X_SHAPE_INPUT } Ecore_X_Shape_Type; +typedef enum _Ecore_X_Mapping_Type +{ + ECORE_X_MAPPING_MODIFIER, + ECORE_X_MAPPING_KEYBOARD, + ECORE_X_MAPPING_MOUSE +} Ecore_X_Mapping_Type; + +typedef enum _Ecore_X_Randr_Property_Change +{ + ECORE_X_RANDR_PROPERTY_CHANGE_ADD, + ECORE_X_RANDR_PROPERTY_CHANGE_DEL +} Ecore_X_Randr_Property_Change; + typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In; typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out; typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In; @@ -320,6 +333,7 @@ typedef struct _Ecore_X_Event_Window_Stack Ecore_X_Event_Window_Stack; typedef struct _Ecore_X_Event_Window_Stack_Request Ecore_X_Event_Window_Stack_Request; typedef struct _Ecore_X_Event_Window_Property Ecore_X_Event_Window_Property; typedef struct _Ecore_X_Event_Window_Colormap Ecore_X_Event_Window_Colormap; +typedef struct _Ecore_X_Event_Mapping_Change Ecore_X_Event_Mapping_Change; typedef struct _Ecore_X_Event_Window_Mapping Ecore_X_Event_Window_Mapping; typedef struct _Ecore_X_Event_Selection_Clear Ecore_X_Event_Selection_Clear; typedef struct _Ecore_X_Event_Selection_Request Ecore_X_Event_Selection_Request; @@ -344,33 +358,12 @@ typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Chang typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change; typedef struct _Ecore_X_Event_Randr_Output_Property_Notify Ecore_X_Event_Randr_Output_Property_Notify; -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_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; - -typedef struct _Ecore_X_Event_Window_Move_Resize_Request -Ecore_X_Event_Window_Move_Resize_Request; -typedef struct _Ecore_X_Event_Window_State_Request -Ecore_X_Event_Window_State_Request; -typedef struct _Ecore_X_Event_Frame_Extents_Request -Ecore_X_Event_Frame_Extents_Request; -typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping; -typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change; +typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request; +typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request; +typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request; +typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request; +typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping; +typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change; typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence; @@ -379,16 +372,15 @@ typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic; typedef struct _Ecore_X_Randr_Screen_Size Ecore_X_Randr_Screen_Size; typedef struct _Ecore_X_Randr_Screen_Size_MM Ecore_X_Randr_Screen_Size_MM; -typedef struct _Ecore_X_Xdnd_Position Ecore_X_Xdnd_Position; +typedef struct _Ecore_X_Xdnd_Position Ecore_X_Xdnd_Position; struct _Ecore_X_Event_Mouse_In { int modifiers; int x, y; - int same_screen; - struct - { - int x, y; + Eina_Bool same_screen : 1; + struct { + int x, y; } root; Ecore_X_Window win; Ecore_X_Window event_win; @@ -403,9 +395,8 @@ struct _Ecore_X_Event_Mouse_Out int modifiers; int x, y; int same_screen; - struct - { - int x, y; + struct { + int x, y; } root; Ecore_X_Window win; Ecore_X_Window event_win; @@ -504,8 +495,8 @@ struct _Ecore_X_Event_Window_Configure Ecore_X_Window abovewin; int x, y, w, h; int border; - unsigned int override : 1; - unsigned int from_wm : 1; + Eina_Bool override : 1; + Eina_Bool from_wm : 1; Ecore_X_Time time; }; @@ -562,10 +553,17 @@ struct _Ecore_X_Event_Window_Colormap { Ecore_X_Window win; Ecore_X_Colormap cmap; - int installed; + Eina_Bool installed : 1; Ecore_X_Time time; }; +struct _Ecore_X_Event_Mapping_Change +{ + Ecore_X_Mapping_Type type; + int keycode; + int num; +}; + struct _Ecore_X_Event_Selection_Clear { Ecore_X_Window win; @@ -606,7 +604,6 @@ struct _Ecore_X_Selection_Data unsigned char *data; int length; int format; - int (*free)(void *data); }; @@ -641,9 +638,8 @@ struct _Ecore_X_Event_Xdnd_Enter struct _Ecore_X_Event_Xdnd_Position { Ecore_X_Window win, source; - struct - { - int x, y; + struct { + int x, y; } position; Ecore_X_Atom action; }; @@ -651,16 +647,15 @@ struct _Ecore_X_Event_Xdnd_Position struct _Ecore_X_Xdnd_Position { Ecore_X_Window win, prev; - struct - { - int x, y; + struct { + int x, y; } position; }; struct _Ecore_X_Event_Xdnd_Status { Ecore_X_Window win, target; - int will_accept; + Eina_Bool will_accept : 1; Ecore_X_Rectangle rectangle; Ecore_X_Atom action; }; @@ -674,16 +669,15 @@ struct _Ecore_X_Event_Xdnd_Drop { Ecore_X_Window win, source; Ecore_X_Atom action; - struct - { - int x, y; + struct { + int x, y; } position; }; struct _Ecore_X_Event_Xdnd_Finished { Ecore_X_Window win, target; - int completed; + Eina_Bool completed : 1; Ecore_X_Atom action; }; @@ -693,26 +687,26 @@ struct _Ecore_X_Event_Client_Message Ecore_X_Atom message_type; int format; union { - char b[20]; - short s[10]; - long l[5]; - } data; + char b[20]; + short s[10]; + long l[5]; + } data; Ecore_X_Time time; }; struct _Ecore_X_Event_Window_Shape { - Ecore_X_Window win; - Ecore_X_Time time; + Ecore_X_Window win; + Ecore_X_Time time; Ecore_X_Shape_Type type; - int x, y, w, h; - Eina_Bool shaped : 1; + int x, y, w, h; + Eina_Bool shaped : 1; }; struct _Ecore_X_Event_Screensaver_Notify { Ecore_X_Window win; - int on; + Eina_Bool on : 1; Ecore_X_Time time; }; @@ -771,11 +765,11 @@ struct _Ecore_X_Event_Randr_Output_Change struct _Ecore_X_Event_Randr_Output_Property_Notify { - Ecore_X_Window win; - Ecore_X_Randr_Output output; - Ecore_X_Atom property; - Ecore_X_Time time; - int state; /* NewValue, Deleted */ + Ecore_X_Window win; + Ecore_X_Randr_Output output; + Ecore_X_Atom property; + Ecore_X_Time time; + Ecore_X_Randr_Property_Change state; }; struct _Ecore_X_Event_Window_Delete_Request @@ -783,64 +777,7 @@ struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Window win; Ecore_X_Time time; }; - -struct _Ecore_X_Event_Window_Prop_Title_Change -{ - Ecore_X_Window win; - char *title; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Window_Prop_Visible_Title_Change -{ - Ecore_X_Window win; - char *title; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Window_Prop_Icon_Name_Change -{ - Ecore_X_Window win; - char *name; - 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_Client_Machine_Change -{ - Ecore_X_Window win; - char *name; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Window_Prop_Name_Class_Change -{ - Ecore_X_Window win; - char *name; - char *clas; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Window_Prop_Pid_Change -{ - Ecore_X_Window win; - pid_t pid; - Ecore_X_Time time; -}; - -struct _Ecore_X_Event_Window_Prop_Desktop_Change -{ - Ecore_X_Window win; - long desktop; - Ecore_X_Time time; -}; - + struct _Ecore_X_Event_Startup_Sequence { Ecore_X_Window win; @@ -917,6 +854,7 @@ EAPI extern int ECORE_X_EVENT_WINDOW_STACK_REQUEST; EAPI extern int ECORE_X_EVENT_WINDOW_PROPERTY; EAPI extern int ECORE_X_EVENT_WINDOW_COLORMAP; EAPI extern int ECORE_X_EVENT_WINDOW_MAPPING; +EAPI extern int ECORE_X_EVENT_MAPPING_CHANGE; EAPI extern int ECORE_X_EVENT_SELECTION_CLEAR; EAPI extern int ECORE_X_EVENT_SELECTION_REQUEST; EAPI extern int ECORE_X_EVENT_SELECTION_NOTIFY; @@ -932,16 +870,6 @@ EAPI extern int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY; EAPI extern int ECORE_X_EVENT_DAMAGE_NOTIFY; EAPI extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST; -/* - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE; - EAPI extern int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE; - */ EAPI extern int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST; EAPI extern int ECORE_X_EVENT_WINDOW_STATE_REQUEST; diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 8a2ef77..a0519f8 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -90,6 +90,7 @@ EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; +EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; @@ -102,16 +103,6 @@ EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0; EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0; EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; -/* - EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0; - */ EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; @@ -532,6 +523,7 @@ ecore_x_init(const char *name) ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); + ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); @@ -544,17 +536,6 @@ ecore_x_init(const char *name) ECORE_X_EVENT_DAMAGE_NOTIFY = 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_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_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); diff --git a/src/lib/ecore_x/xcb/ecore_xcb_events.c b/src/lib/ecore_x/xcb/ecore_xcb_events.c index 82055e0..0f39591 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_events.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_events.c @@ -20,15 +20,6 @@ #define CODESET "INVALID" #endif /* ifndef CODESET */ -#if 0 -static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev); -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_window_prop_client_machine_change(void *data, void *ev); -#endif /* if 0 */ - static Ecore_X_Window _ecore_xcb_mouse_down_last_window = 0; static Ecore_X_Window _ecore_xcb_mouse_down_last_last_window = 0; static Ecore_X_Window _ecore_xcb_mouse_down_last_event_window = 0; @@ -99,84 +90,6 @@ ecore_x_event_mask_unset(Ecore_X_Window window, free(reply); } /* ecore_x_event_mask_unset */ -#if 0 -static void -_ecore_x_event_free_window_prop_name_class_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Name_Class_Change *e; - - e = ev; - if (e->name) - free(e->name); - - if (e->clas) - free(e->clas); - - free(e); -} /* _ecore_x_event_free_window_prop_name_class_change */ - -static void -_ecore_x_event_free_window_prop_title_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Title_Change *e; - - e = ev; - if (e->title) - free(e->title); - - free(e); -} /* _ecore_x_event_free_window_prop_title_change */ - -static void -_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Visible_Title_Change *e; - - e = ev; - if (e->title) - free(e->title); - - free(e); -} /* _ecore_x_event_free_window_prop_visible_title_change */ - -static void -_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Icon_Name_Change *e; - - e = ev; - if (e->name) - free(e->name); - - free(e); -} /* _ecore_x_event_free_window_prop_icon_name_change */ - -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); -} /* _ecore_x_event_free_window_prop_visible_icon_name_change */ - -static void -_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Client_Machine_Change *e; - - e = ev; - if (e->name) - free(e->name); - - free(e); -} /* _ecore_x_event_free_window_prop_client_machine_change */ - -#endif /* if 0 */ - static void _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev) { @@ -1377,114 +1290,6 @@ _ecore_x_event_handle_circulate_request(xcb_generic_event_t *event) void _ecore_x_event_handle_property_notify(xcb_generic_event_t *event) { -#if 0 /* for now i disabled this. nice idea though this is - it leaves a lot - * to be desired for efficiency that is better left to the app layer - */ - if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS) - { - Ecore_X_Event_Window_Prop_Name_Class_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change)); - if (!e) - return; - - ecore_x_window_prop_name_class_get(xevent->xproperty.window, - &(e->name), &(e->clas)); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL); - } - else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME)) - { - Ecore_X_Event_Window_Prop_Title_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change)); - if (!e) - return; - - e->title = ecore_x_window_prop_title_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL); - } - else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME) - { - Ecore_X_Event_Window_Prop_Visible_Title_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change)); - if (!e) - return; - - e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL); - } - else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME)) - { - Ecore_X_Event_Window_Prop_Icon_Name_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change)); - if (!e) - return; - - e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - 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); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - 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 if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE) - { - Ecore_X_Event_Window_Prop_Client_Machine_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change)); - if (!e) - return; - - e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL); - } - else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID) - { - Ecore_X_Event_Window_Prop_Pid_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change)); - if (!e) - return; - - e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, 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, NULL, NULL); - } - else -#endif /* if 0 */ { xcb_property_notify_event_t *ev; Ecore_X_Event_Window_Property *e; diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index fb00931..9426f41 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -89,6 +89,7 @@ EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; +EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; @@ -103,17 +104,6 @@ EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0; EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0; EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0; EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; -/* - EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0; - EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0; - */ - EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; @@ -467,6 +457,7 @@ ecore_x_init(const char *name) ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); + ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); @@ -482,16 +473,6 @@ ecore_x_init(const char *name) ECORE_X_EVENT_DAMAGE_NOTIFY = 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_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_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c index 43421c4..a199e0e 100644 --- a/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/src/lib/ecore_x/xlib/ecore_x_events.c @@ -22,20 +22,6 @@ #define CODESET "INVALID" #endif /* ifndef CODESET */ -#if 0 -static void _ecore_x_event_free_window_prop_name_class_change(void *data, - void *ev); -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_window_prop_client_machine_change(void *data, - void *ev); -#endif /* if 0 */ - static Window _ecore_x_mouse_down_last_win = 0; static Window _ecore_x_mouse_down_last_last_win = 0; static Window _ecore_x_mouse_down_last_event_win = 0; @@ -95,84 +81,6 @@ ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask) XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); } /* ecore_x_event_mask_unset */ -#if 0 -static void -_ecore_x_event_free_window_prop_name_class_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Name_Class_Change *e; - - e = ev; - if (e->name) - free(e->name); - - if (e->clas) - free(e->clas); - - free(e); -} /* _ecore_x_event_free_window_prop_name_class_change */ - -static void -_ecore_x_event_free_window_prop_title_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Title_Change *e; - - e = ev; - if (e->title) - free(e->title); - - free(e); -} /* _ecore_x_event_free_window_prop_title_change */ - -static void -_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Visible_Title_Change *e; - - e = ev; - if (e->title) - free(e->title); - - free(e); -} /* _ecore_x_event_free_window_prop_visible_title_change */ - -static void -_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Icon_Name_Change *e; - - e = ev; - if (e->name) - free(e->name); - - free(e); -} /* _ecore_x_event_free_window_prop_icon_name_change */ - -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); -} /* _ecore_x_event_free_window_prop_visible_icon_name_change */ - -static void -_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev) -{ - Ecore_X_Event_Window_Prop_Client_Machine_Change *e; - - e = ev; - if (e->name) - free(e->name); - - free(e); -} /* _ecore_x_event_free_window_prop_client_machine_change */ - -#endif /* if 0 */ - static void _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev) { @@ -1376,132 +1284,6 @@ void _ecore_x_event_handle_property_notify(XEvent *xevent) { _ecore_x_last_event_mouse_move = 0; -#if 0 /* for now i disabled this. nice idea though this is - it leaves a lot - * to be desired for efficiency that is better left to the app layer - */ - if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS) - { - Ecore_X_Event_Window_Prop_Name_Class_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change)); - if (!e) - return; - - ecore_x_window_prop_name_class_get(xevent->xproperty.window, - &(e->name), &(e->clas)); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, - _ecore_x_event_free_window_prop_name_class_change, NULL); - } - else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) || - (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME)) - { - Ecore_X_Event_Window_Prop_Title_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change)); - if (!e) - return; - - e->title = ecore_x_window_prop_title_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, - _ecore_x_event_free_window_prop_title_change, NULL); - } - else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME) - { - Ecore_X_Event_Window_Prop_Visible_Title_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change)); - if (!e) - return; - - e->title = ecore_x_window_prop_visible_title_get( - xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, - e, - _ecore_x_event_free_window_prop_visible_title_change, - NULL); - } - else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) || - (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME)) - { - Ecore_X_Event_Window_Prop_Icon_Name_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change)); - if (!e) - return; - - e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - 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); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - 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 if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE) - { - Ecore_X_Event_Window_Prop_Client_Machine_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change)); - if (!e) - return; - - e->name = ecore_x_window_prop_client_machine_get( - xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, - e, - _ecore_x_event_free_window_prop_client_machine_change, - NULL); - } - else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID) - { - Ecore_X_Event_Window_Prop_Pid_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change)); - if (!e) - return; - - e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window); - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, 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, NULL, NULL); - } - else -#endif /* if 0 */ { Ecore_X_Event_Window_Property *e; @@ -1691,9 +1473,9 @@ _ecore_x_event_handle_colormap_notify(XEvent *xevent) e->cmap = xevent->xcolormap.colormap; e->time = _ecore_x_event_last_time; if (xevent->xcolormap.state == ColormapInstalled) - e->installed = 1; + e->installed = EINA_TRUE; else - e->installed = 0; + e->installed = EINA_FALSE; ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); } /* _ecore_x_event_handle_colormap_notify */ @@ -1941,7 +1723,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) { Ecore_X_Event_Xdnd_Finished *e; Ecore_X_DND_Source *source; - int completed = 1; + Eina_Bool completed = EINA_TRUE; LOGFN(__FILE__, __LINE__, __FUNCTION__); source = _ecore_x_dnd_source_get(); @@ -1959,7 +1741,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) } else if (source->version >= 5) { - completed = 0; + completed = EINA_FALSE; source->state = ECORE_X_DND_SOURCE_CONVERTING; /* FIXME: Probably need to add a timer to switch back to idle @@ -2153,8 +1935,28 @@ _ecore_x_event_handle_client_message(XEvent *xevent) void _ecore_x_event_handle_mapping_notify(XEvent *xevent) { + Ecore_X_Event_Mapping_Change *e; + _ecore_x_last_event_mouse_move = 0; XRefreshKeyboardMapping((XMappingEvent *)xevent); + e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); + if (!e) return; + switch (xevent->xmapping.request) + { + case MappingModifier: + e->type = ECORE_X_MAPPING_MODIFIER; + break; + case MappingKeyboard: + e->type = ECORE_X_MAPPING_KEYBOARD; + break; + case MappingPointer: + default: + e->type = ECORE_X_MAPPING_MOUSE; + break; + } + e->keycode = xevent->xmapping.first_keycode; + e->num = xevent->xmapping.count; + ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); } /* _ecore_x_event_handle_mapping_notify */ void @@ -2208,9 +2010,9 @@ _ecore_x_event_handle_screensaver_notify(XEvent *xevent) e->win = screensaver_event->window; if (screensaver_event->state == ScreenSaverOn) - e->on = 1; + e->on = EINA_TRUE; else - e->on = 0; + e->on = EINA_TRUE; e->time = screensaver_event->time; ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); @@ -2343,7 +2145,10 @@ _ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) e->output = randr_event->output; e->property = randr_event->property; e->time = randr_event->timestamp; - e->state = randr_event->state; + if (randr_event->state == PropertyNewValue) + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; + else + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); } /* _ecore_x_event_handle_randr_notify_output_property */ -- 2.7.4