From 8b610a7aa636f76fd3a3e5fa0512a660efa119eb Mon Sep 17 00:00:00 2001 From: puppetmaster Date: Thu, 28 Jul 2005 21:36:12 +0000 Subject: fix for raster indentation --- ecore/src/lib/ecore_x/ecore_x.c | 1546 ++++++++++++++++++++------------------- 1 file changed, 804 insertions(+), 742 deletions(-) diff --git a/ecore/src/lib/ecore_x/ecore_x.c b/ecore/src/lib/ecore_x/ecore_x.c index 7fb0924..cbbb32d 100644 --- a/ecore/src/lib/ecore_x/ecore_x.c +++ b/ecore/src/lib/ecore_x/ecore_x.c @@ -7,122 +7,126 @@ #include "Ecore_X.h" #include "Ecore_X_Atoms.h" -static int _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); -static int _ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler); -static int _ecore_x_key_mask_get(KeySym sym); -static void *_ecore_x_event_filter_start(void *data); -static int _ecore_x_event_filter_filter(void *data, void *loop_data,int type, void *event); -static void _ecore_x_event_filter_end(void *data, void *loop_data); +static int _ecore_x_fd_handler(void *data, + Ecore_Fd_Handler * fd_handler); +static int _ecore_x_fd_handler_buf(void *data, + Ecore_Fd_Handler * fd_handler); +static int _ecore_x_key_mask_get(KeySym sym); +static void *_ecore_x_event_filter_start(void *data); +static int _ecore_x_event_filter_filter(void *data, void *loop_data, + int type, void *event); +static void _ecore_x_event_filter_end(void *data, void *loop_data); static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL; static Ecore_Event_Filter *_ecore_x_filter_handler = NULL; -static int _ecore_x_event_shape_id = 0; -static int _ecore_x_event_sync_id = 0; -static int _ecore_x_event_scrnsaver_id = 0; -static int _ecore_x_event_handlers_num = 0; -static void (**_ecore_x_event_handlers) (XEvent * event) = NULL; +static int _ecore_x_event_shape_id = 0; +static int _ecore_x_event_sync_id = 0; +static int _ecore_x_event_scrnsaver_id = 0; +static int _ecore_x_event_handlers_num = 0; +static void (**_ecore_x_event_handlers) (XEvent * event) = NULL; -static int _ecore_x_init_count = 0; -static int _ecore_x_grab_count = 0; +static int _ecore_x_init_count = 0; +static int _ecore_x_grab_count = 0; -Display *_ecore_x_disp = NULL; -double _ecore_x_double_click_time = 0.25; -Time _ecore_x_event_last_time = 0; -Window _ecore_x_event_last_win = 0; -int _ecore_x_event_last_root_x = 0; -int _ecore_x_event_last_root_y = 0; -int _ecore_x_xcursor = 0; +Display *_ecore_x_disp = NULL; +double _ecore_x_double_click_time = 0.25; +Time _ecore_x_event_last_time = 0; +Window _ecore_x_event_last_win = 0; +int _ecore_x_event_last_root_x = 0; +int _ecore_x_event_last_root_y = 0; +int _ecore_x_xcursor = 0; -Ecore_X_Window _ecore_x_private_win = 0; +Ecore_X_Window _ecore_x_private_win = 0; /* FIXME - These are duplicates after making ecore atoms public */ -Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0; -Ecore_X_Atom ECORE_X_ATOM_STRING = 0; -Ecore_X_Atom ECORE_X_ATOM_TEXT = 0; -Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0; -Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0; +Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0; +Ecore_X_Atom ECORE_X_ATOM_STRING = 0; +Ecore_X_Atom ECORE_X_ATOM_TEXT = 0; +Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0; +Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0; -Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; +Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; /* * GNOME hints. */ -Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0; +Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0; /* * Other hints. */ -Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0; - -Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0; -Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0; -Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0; + +Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0; +Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0; +Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0; /* Xdnd atoms that need to be exposed to the application interface */ -Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0; -Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0; -Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0; -Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0; -Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0; - -int ECORE_X_EVENT_KEY_DOWN = 0; -int ECORE_X_EVENT_KEY_UP = 0; -int ECORE_X_EVENT_MOUSE_BUTTON_DOWN = 0; -int ECORE_X_EVENT_MOUSE_BUTTON_UP = 0; -int ECORE_X_EVENT_MOUSE_MOVE = 0; -int ECORE_X_EVENT_MOUSE_IN = 0; -int ECORE_X_EVENT_MOUSE_OUT = 0; -int ECORE_X_EVENT_MOUSE_WHEEL = 0; -int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; -int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; -int ECORE_X_EVENT_WINDOW_KEYMAP = 0; -int ECORE_X_EVENT_WINDOW_DAMAGE = 0; -int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; -int ECORE_X_EVENT_WINDOW_CREATE = 0; -int ECORE_X_EVENT_WINDOW_DESTROY = 0; -int ECORE_X_EVENT_WINDOW_HIDE = 0; -int ECORE_X_EVENT_WINDOW_SHOW = 0; -int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_REPARENT = 0; -int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; -int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_GRAVITY = 0; -int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_STACK = 0; -int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_PROPERTY = 0; -int ECORE_X_EVENT_WINDOW_COLORMAP = 0; -int ECORE_X_EVENT_WINDOW_MAPPING = 0; -int ECORE_X_EVENT_SELECTION_CLEAR = 0; -int ECORE_X_EVENT_SELECTION_REQUEST = 0; -int ECORE_X_EVENT_SELECTION_NOTIFY = 0; -int ECORE_X_EVENT_CLIENT_MESSAGE = 0; -int ECORE_X_EVENT_WINDOW_SHAPE = 0; -int ECORE_X_EVENT_SYNC_COUNTER = 0; -int ECORE_X_EVENT_SYNC_ALARM = 0; - -int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; +Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0; +Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0; +Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0; +Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0; +Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0; + +int ECORE_X_EVENT_KEY_DOWN = 0; +int ECORE_X_EVENT_KEY_UP = 0; +int ECORE_X_EVENT_MOUSE_BUTTON_DOWN = 0; +int ECORE_X_EVENT_MOUSE_BUTTON_UP = 0; +int ECORE_X_EVENT_MOUSE_MOVE = 0; +int ECORE_X_EVENT_MOUSE_IN = 0; +int ECORE_X_EVENT_MOUSE_OUT = 0; +int ECORE_X_EVENT_MOUSE_WHEEL = 0; +int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; +int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; +int ECORE_X_EVENT_WINDOW_KEYMAP = 0; +int ECORE_X_EVENT_WINDOW_DAMAGE = 0; +int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; +int ECORE_X_EVENT_WINDOW_CREATE = 0; +int ECORE_X_EVENT_WINDOW_DESTROY = 0; +int ECORE_X_EVENT_WINDOW_HIDE = 0; +int ECORE_X_EVENT_WINDOW_SHOW = 0; +int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_REPARENT = 0; +int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; +int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_GRAVITY = 0; +int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_STACK = 0; +int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_PROPERTY = 0; +int ECORE_X_EVENT_WINDOW_COLORMAP = 0; +int ECORE_X_EVENT_WINDOW_MAPPING = 0; +int ECORE_X_EVENT_SELECTION_CLEAR = 0; +int ECORE_X_EVENT_SELECTION_REQUEST = 0; +int ECORE_X_EVENT_SELECTION_NOTIFY = 0; +int ECORE_X_EVENT_CLIENT_MESSAGE = 0; +int ECORE_X_EVENT_WINDOW_SHAPE = 0; +int ECORE_X_EVENT_SYNC_COUNTER = 0; +int ECORE_X_EVENT_SYNC_ALARM = 0; + +int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; + /* int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0; @@ -134,27 +138,27 @@ int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0; int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0; */ -int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; -int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; -int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; -int ECORE_X_EVENT_PING = 0; -int ECORE_X_EVENT_DESKTOP_CHANGE = 0; +int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; +int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; +int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; +int ECORE_X_EVENT_PING = 0; +int ECORE_X_EVENT_DESKTOP_CHANGE = 0; -int ECORE_X_EVENT_XDND_ENTER = 0; -int ECORE_X_EVENT_XDND_POSITION = 0; -int ECORE_X_EVENT_XDND_STATUS = 0; -int ECORE_X_EVENT_XDND_LEAVE = 0; -int ECORE_X_EVENT_XDND_DROP = 0; -int ECORE_X_EVENT_XDND_FINISHED = 0; +int ECORE_X_EVENT_XDND_ENTER = 0; +int ECORE_X_EVENT_XDND_POSITION = 0; +int ECORE_X_EVENT_XDND_STATUS = 0; +int ECORE_X_EVENT_XDND_LEAVE = 0; +int ECORE_X_EVENT_XDND_DROP = 0; +int ECORE_X_EVENT_XDND_FINISHED = 0; -int ECORE_X_MODIFIER_SHIFT = 0; -int ECORE_X_MODIFIER_CTRL = 0; -int ECORE_X_MODIFIER_ALT = 0; -int ECORE_X_MODIFIER_WIN = 0; +int ECORE_X_MODIFIER_SHIFT = 0; +int ECORE_X_MODIFIER_CTRL = 0; +int ECORE_X_MODIFIER_ALT = 0; +int ECORE_X_MODIFIER_WIN = 0; -int ECORE_X_LOCK_SCROLL = 0; -int ECORE_X_LOCK_NUM = 0; -int ECORE_X_LOCK_CAPS = 0; +int ECORE_X_LOCK_SCROLL = 0; +int ECORE_X_LOCK_NUM = 0; +int ECORE_X_LOCK_CAPS = 0; /** * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions @@ -174,103 +178,124 @@ int ECORE_X_LOCK_CAPS = 0; int ecore_x_init(const char *name) { - int shape_base = 0; - int shape_err_base = 0; - int sync_base = 0; - int sync_err_base = 0; - int scrnsaver_base = 0; - int scrnsaver_err_base = 0; - - if (_ecore_x_init_count > 0) + int shape_base = 0; + int shape_err_base = 0; + int sync_base = 0; + int sync_err_base = 0; + int scrnsaver_base = 0; + int scrnsaver_err_base = 0; + + if (_ecore_x_init_count > 0) { _ecore_x_init_count++; return _ecore_x_init_count; } _ecore_x_disp = XOpenDisplay((char *)name); - if (!_ecore_x_disp) return 0; + if (!_ecore_x_disp) + return 0; _ecore_x_error_handler_init(); _ecore_x_event_handlers_num = LASTEvent; if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base)) - _ecore_x_event_shape_id = shape_base + ShapeNotify; + _ecore_x_event_shape_id = shape_base + ShapeNotify; if (_ecore_x_event_shape_id >= LASTEvent) - _ecore_x_event_handlers_num = _ecore_x_event_shape_id + 1; + _ecore_x_event_handlers_num = _ecore_x_event_shape_id + 1; if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base)) { - int major, minor; + int major, minor; _ecore_x_event_sync_id = sync_base; if (!XSyncInitialize(_ecore_x_disp, &major, &minor)) - _ecore_x_event_sync_id = 0; + _ecore_x_event_sync_id = 0; } - if (_ecore_x_event_sync_id + XSyncAlarmNotify >= LASTEvent) - _ecore_x_event_handlers_num = _ecore_x_event_sync_id + XSyncAlarmNotify + 1; + _ecore_x_event_handlers_num = + _ecore_x_event_sync_id + XSyncAlarmNotify + 1; - _ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *)); + _ecore_x_event_handlers = + calloc(_ecore_x_event_handlers_num, sizeof(void *)); if (!_ecore_x_event_handlers) { - XCloseDisplay(_ecore_x_disp); + XCloseDisplay(_ecore_x_disp); _ecore_x_fd_handler_handle = NULL; _ecore_x_disp = NULL; - return 0; + return 0; } + /* For XScreenSaver extention of X */ + if (XScreenSaverQueryExtension + (_ecore_x_disp, &scrnsaver_base, &scrnsaver_err_base)) + { + int v_major, v_minor; + + _ecore_x_event_scrnsaver_id = scrnsaver_base + ScreenSaverNotify; + + if (XScreenSaverQueryVersion(ecore_x_disp, v_major, v_minor)) + _ecore_x_event_scrnsaver_id = 0; + + } + if (_ecore_x_event_scrnsaver_id >= LASTEvent) + _ecore_x_event_handlers_num = _ecore_x_event_scrnsaver_id + 1; - /* For XScreenSaver extention of X */ - if (XScreenSaverQueryExtension(_ecore_x_disp, &scrnsaver_base, &scrnsaver_err_base)) - { - int v_major, v_minor; - - _ecore_x_event_scrnsaver_id = scrnsaver_base + ScreenSaverNotify; - - if (XScreenSaverQueryVersion(ecore_x_disp, v_major, v_minor)) - _ecore_x_event_scrnsaver_id = 0; - - if (_ecore_x_event_scrnsaver_id >= LASTEvent) - _ecore_x_event_handlers_num = _ecore_x_event_scrnsaver_id + 1; - } - /***********************************/ -#ifdef ECORE_XCURSOR +#ifdef ECORE_XCURSOR _ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp); #endif - _ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press; - _ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release; - _ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press; - _ecore_x_event_handlers[ButtonRelease] = _ecore_x_event_handle_button_release; - _ecore_x_event_handlers[MotionNotify] = _ecore_x_event_handle_motion_notify; - _ecore_x_event_handlers[EnterNotify] = _ecore_x_event_handle_enter_notify; - _ecore_x_event_handlers[LeaveNotify] = _ecore_x_event_handle_leave_notify; - _ecore_x_event_handlers[FocusIn] = _ecore_x_event_handle_focus_in; - _ecore_x_event_handlers[FocusOut] = _ecore_x_event_handle_focus_out; - _ecore_x_event_handlers[KeymapNotify] = _ecore_x_event_handle_keymap_notify; - _ecore_x_event_handlers[Expose] = _ecore_x_event_handle_expose; - _ecore_x_event_handlers[GraphicsExpose] = _ecore_x_event_handle_graphics_expose; - _ecore_x_event_handlers[VisibilityNotify] = _ecore_x_event_handle_visibility_notify; - _ecore_x_event_handlers[CreateNotify] = _ecore_x_event_handle_create_notify; - _ecore_x_event_handlers[DestroyNotify] = _ecore_x_event_handle_destroy_notify; - _ecore_x_event_handlers[UnmapNotify] = _ecore_x_event_handle_unmap_notify; - _ecore_x_event_handlers[MapNotify] = _ecore_x_event_handle_map_notify; - _ecore_x_event_handlers[MapRequest] = _ecore_x_event_handle_map_request; - _ecore_x_event_handlers[ReparentNotify] = _ecore_x_event_handle_reparent_notify; - _ecore_x_event_handlers[ConfigureNotify] = _ecore_x_event_handle_configure_notify; - _ecore_x_event_handlers[ConfigureRequest] = _ecore_x_event_handle_configure_request; - _ecore_x_event_handlers[GravityNotify] = _ecore_x_event_handle_gravity_notify; - _ecore_x_event_handlers[ResizeRequest] = _ecore_x_event_handle_resize_request; - _ecore_x_event_handlers[CirculateNotify] = _ecore_x_event_handle_circulate_notify; - _ecore_x_event_handlers[CirculateRequest] = _ecore_x_event_handle_circulate_request; - _ecore_x_event_handlers[PropertyNotify] = _ecore_x_event_handle_property_notify; - _ecore_x_event_handlers[SelectionClear] = _ecore_x_event_handle_selection_clear; - _ecore_x_event_handlers[SelectionRequest] = _ecore_x_event_handle_selection_request; - _ecore_x_event_handlers[SelectionNotify] = _ecore_x_event_handle_selection_notify; - _ecore_x_event_handlers[ColormapNotify] = _ecore_x_event_handle_colormap_notify; - _ecore_x_event_handlers[MappingNotify] = _ecore_x_event_handle_mapping_notify; - _ecore_x_event_handlers[ClientMessage] = _ecore_x_event_handle_client_message; + _ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press; + _ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release; + _ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press; + _ecore_x_event_handlers[ButtonRelease] = + _ecore_x_event_handle_button_release; + _ecore_x_event_handlers[MotionNotify] = _ecore_x_event_handle_motion_notify; + _ecore_x_event_handlers[EnterNotify] = _ecore_x_event_handle_enter_notify; + _ecore_x_event_handlers[LeaveNotify] = _ecore_x_event_handle_leave_notify; + _ecore_x_event_handlers[FocusIn] = _ecore_x_event_handle_focus_in; + _ecore_x_event_handlers[FocusOut] = _ecore_x_event_handle_focus_out; + _ecore_x_event_handlers[KeymapNotify] = _ecore_x_event_handle_keymap_notify; + _ecore_x_event_handlers[Expose] = _ecore_x_event_handle_expose; + _ecore_x_event_handlers[GraphicsExpose] = + _ecore_x_event_handle_graphics_expose; + _ecore_x_event_handlers[VisibilityNotify] = + _ecore_x_event_handle_visibility_notify; + _ecore_x_event_handlers[CreateNotify] = _ecore_x_event_handle_create_notify; + _ecore_x_event_handlers[DestroyNotify] = + _ecore_x_event_handle_destroy_notify; + _ecore_x_event_handlers[UnmapNotify] = _ecore_x_event_handle_unmap_notify; + _ecore_x_event_handlers[MapNotify] = _ecore_x_event_handle_map_notify; + _ecore_x_event_handlers[MapRequest] = _ecore_x_event_handle_map_request; + _ecore_x_event_handlers[ReparentNotify] = + _ecore_x_event_handle_reparent_notify; + _ecore_x_event_handlers[ConfigureNotify] = + _ecore_x_event_handle_configure_notify; + _ecore_x_event_handlers[ConfigureRequest] = + _ecore_x_event_handle_configure_request; + _ecore_x_event_handlers[GravityNotify] = + _ecore_x_event_handle_gravity_notify; + _ecore_x_event_handlers[ResizeRequest] = + _ecore_x_event_handle_resize_request; + _ecore_x_event_handlers[CirculateNotify] = + _ecore_x_event_handle_circulate_notify; + _ecore_x_event_handlers[CirculateRequest] = + _ecore_x_event_handle_circulate_request; + _ecore_x_event_handlers[PropertyNotify] = + _ecore_x_event_handle_property_notify; + _ecore_x_event_handlers[SelectionClear] = + _ecore_x_event_handle_selection_clear; + _ecore_x_event_handlers[SelectionRequest] = + _ecore_x_event_handle_selection_request; + _ecore_x_event_handlers[SelectionNotify] = + _ecore_x_event_handle_selection_notify; + _ecore_x_event_handlers[ColormapNotify] = + _ecore_x_event_handle_colormap_notify; + _ecore_x_event_handlers[MappingNotify] = + _ecore_x_event_handle_mapping_notify; + _ecore_x_event_handlers[ClientMessage] = + _ecore_x_event_handle_client_message; if (_ecore_x_event_shape_id) - _ecore_x_event_handlers[_ecore_x_event_shape_id] = _ecore_x_event_handle_shape_change; + _ecore_x_event_handlers[_ecore_x_event_shape_id] = + _ecore_x_event_handle_shape_change; if (_ecore_x_event_sync_id) { _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncCounterNotify] = @@ -280,95 +305,95 @@ ecore_x_init(const char *name) } if (!ECORE_X_EVENT_KEY_DOWN) { - ECORE_X_EVENT_KEY_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_KEY_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_MOVE = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_WHEEL = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); + ECORE_X_EVENT_KEY_DOWN = ecore_event_type_new(); + ECORE_X_EVENT_KEY_UP = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_MOVE = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_WHEEL = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); - 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_SELECTION_CLEAR = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); - - ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); + 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_SELECTION_CLEAR = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_ALARM = 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_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(); - ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_PING = ecore_event_type_new(); - - ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); - ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); - ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); - ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); - ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); - ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_PING = ecore_event_type_new(); + + ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); + ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); + ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); + ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); + ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); + ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); } - + /* everything has these... unless its like a pda... :) */ ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); - ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); - + ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); + /* apple's xdarwin has no alt!!!! */ - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); - + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); + /* the windows key... a valid modifier :) */ - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); - - ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); - ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); - ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); - - _ecore_x_fd_handler_handle = - ecore_main_fd_handler_add(ConnectionNumber(_ecore_x_disp), - ECORE_FD_READ, - _ecore_x_fd_handler, _ecore_x_disp, - _ecore_x_fd_handler_buf, _ecore_x_disp); + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); + + ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); + ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); + ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); + + _ecore_x_fd_handler_handle = + ecore_main_fd_handler_add(ConnectionNumber(_ecore_x_disp), + ECORE_FD_READ, + _ecore_x_fd_handler, _ecore_x_disp, + _ecore_x_fd_handler_buf, _ecore_x_disp); if (!_ecore_x_fd_handler_handle) { XCloseDisplay(_ecore_x_disp); @@ -378,73 +403,99 @@ ecore_x_init(const char *name) _ecore_x_event_handlers = NULL; 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_COMPOUND_TEXT = XInternAtom(_ecore_x_disp, "COMPOUND_TEXT", False); - ECORE_X_ATOM_UTF8_STRING = XInternAtom(_ecore_x_disp, "UTF8_STRING", False); - ECORE_X_ATOM_FILE_NAME = XInternAtom(_ecore_x_disp, "FILE_NAME", False); - ECORE_X_ATOM_STRING = XInternAtom(_ecore_x_disp, "STRING", False); - ECORE_X_ATOM_TEXT = XInternAtom(_ecore_x_disp, "TEXT", False); + _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_COMPOUND_TEXT = + XInternAtom(_ecore_x_disp, "COMPOUND_TEXT", False); + ECORE_X_ATOM_UTF8_STRING = XInternAtom(_ecore_x_disp, "UTF8_STRING", False); + ECORE_X_ATOM_FILE_NAME = XInternAtom(_ecore_x_disp, "FILE_NAME", False); + ECORE_X_ATOM_STRING = XInternAtom(_ecore_x_disp, "STRING", False); + ECORE_X_ATOM_TEXT = XInternAtom(_ecore_x_disp, "TEXT", False); /* Set up the ICCCM hints */ ecore_x_icccm_init(); - ECORE_X_ATOM_MOTIF_WM_HINTS = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", 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_WIN_LAYER = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False); /* Set up the _NET_... hints */ ecore_x_netwm_init(); /* old e hints init */ ecore_x_e_init(); - + /* This is just to be anal about naming conventions */ - ECORE_X_ATOM_SELECTION_TARGETS = XInternAtom(_ecore_x_disp, "TARGETS", False); - ECORE_X_ATOM_SELECTION_PRIMARY = XA_PRIMARY; - ECORE_X_ATOM_SELECTION_SECONDARY = XA_SECONDARY; - ECORE_X_ATOM_SELECTION_CLIPBOARD = XInternAtom(_ecore_x_disp, "CLIPBOARD", False); - ECORE_X_ATOM_SELECTION_PROP_PRIMARY = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False); - ECORE_X_ATOM_SELECTION_PROP_SECONDARY = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False); - ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False); - ECORE_X_ATOM_SELECTION_PROP_XDND = XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False); - ECORE_X_ATOM_SELECTION_XDND = XInternAtom(_ecore_x_disp, "XdndSelection", False); - ECORE_X_ATOM_XDND_AWARE = XInternAtom(_ecore_x_disp, "XdndAware", False); - ECORE_X_ATOM_XDND_TYPE_LIST = XInternAtom(_ecore_x_disp, "XdndTypeList", False); - ECORE_X_ATOM_XDND_ENTER = XInternAtom(_ecore_x_disp, "XdndEnter", False); - ECORE_X_ATOM_XDND_POSITION = XInternAtom(_ecore_x_disp, "XdndPosition", False); - ECORE_X_ATOM_XDND_ACTION_COPY = XInternAtom(_ecore_x_disp, "XdndActionCopy", False); - ECORE_X_ATOM_XDND_ACTION_MOVE = XInternAtom(_ecore_x_disp, "XdndActionMove", False); - ECORE_X_ATOM_XDND_ACTION_PRIVATE = XInternAtom(_ecore_x_disp, "XdndActionPrivate", False); - ECORE_X_ATOM_XDND_ACTION_ASK = XInternAtom(_ecore_x_disp, "XdndActionAsk", False); - ECORE_X_ATOM_XDND_ACTION_LIST = XInternAtom(_ecore_x_disp, "XdndActionList", False); - ECORE_X_ATOM_XDND_ACTION_LINK = XInternAtom(_ecore_x_disp, "XdndActionLink", False); - ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = XInternAtom(_ecore_x_disp, "XdndActionDescription", False); - ECORE_X_ATOM_XDND_PROXY = XInternAtom(_ecore_x_disp, "XdndProxy", False); - ECORE_X_ATOM_XDND_STATUS = XInternAtom(_ecore_x_disp, "XdndStatus", False); - ECORE_X_ATOM_XDND_LEAVE = XInternAtom(_ecore_x_disp, "XdndLeave", False); - ECORE_X_ATOM_XDND_DROP = XInternAtom(_ecore_x_disp, "XdndDrop", False); - ECORE_X_ATOM_XDND_FINISHED = XInternAtom(_ecore_x_disp, "XdndFinished", False); + ECORE_X_ATOM_SELECTION_TARGETS = + XInternAtom(_ecore_x_disp, "TARGETS", False); + ECORE_X_ATOM_SELECTION_PRIMARY = XA_PRIMARY; + ECORE_X_ATOM_SELECTION_SECONDARY = XA_SECONDARY; + ECORE_X_ATOM_SELECTION_CLIPBOARD = + XInternAtom(_ecore_x_disp, "CLIPBOARD", False); + ECORE_X_ATOM_SELECTION_PROP_PRIMARY = + XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False); + ECORE_X_ATOM_SELECTION_PROP_SECONDARY = + XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False); + ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = + XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False); + ECORE_X_ATOM_SELECTION_PROP_XDND = + XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False); + ECORE_X_ATOM_SELECTION_XDND = + XInternAtom(_ecore_x_disp, "XdndSelection", False); + ECORE_X_ATOM_XDND_AWARE = XInternAtom(_ecore_x_disp, "XdndAware", False); + ECORE_X_ATOM_XDND_TYPE_LIST = + XInternAtom(_ecore_x_disp, "XdndTypeList", False); + ECORE_X_ATOM_XDND_ENTER = XInternAtom(_ecore_x_disp, "XdndEnter", False); + ECORE_X_ATOM_XDND_POSITION = + XInternAtom(_ecore_x_disp, "XdndPosition", False); + ECORE_X_ATOM_XDND_ACTION_COPY = + XInternAtom(_ecore_x_disp, "XdndActionCopy", False); + ECORE_X_ATOM_XDND_ACTION_MOVE = + XInternAtom(_ecore_x_disp, "XdndActionMove", False); + ECORE_X_ATOM_XDND_ACTION_PRIVATE = + XInternAtom(_ecore_x_disp, "XdndActionPrivate", False); + ECORE_X_ATOM_XDND_ACTION_ASK = + XInternAtom(_ecore_x_disp, "XdndActionAsk", False); + ECORE_X_ATOM_XDND_ACTION_LIST = + XInternAtom(_ecore_x_disp, "XdndActionList", False); + ECORE_X_ATOM_XDND_ACTION_LINK = + XInternAtom(_ecore_x_disp, "XdndActionLink", False); + ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = + XInternAtom(_ecore_x_disp, "XdndActionDescription", False); + ECORE_X_ATOM_XDND_PROXY = XInternAtom(_ecore_x_disp, "XdndProxy", False); + ECORE_X_ATOM_XDND_STATUS = XInternAtom(_ecore_x_disp, "XdndStatus", False); + ECORE_X_ATOM_XDND_LEAVE = XInternAtom(_ecore_x_disp, "XdndLeave", False); + ECORE_X_ATOM_XDND_DROP = XInternAtom(_ecore_x_disp, "XdndDrop", False); + ECORE_X_ATOM_XDND_FINISHED = + XInternAtom(_ecore_x_disp, "XdndFinished", False); /* Initialize the globally defined xdnd atoms */ - ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY; - ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE; - ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK; - ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK; - ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE; - - _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = ECORE_X_ATOM_WM_DELETE_WINDOW; - _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = ECORE_X_ATOM_WM_TAKE_FOCUS; - _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_PING] = ECORE_X_ATOM_NET_WM_PING; - _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY; + ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE; + ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK; + ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK; + ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE; + + _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = + ECORE_X_ATOM_WM_DELETE_WINDOW; + _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = + ECORE_X_ATOM_WM_TAKE_FOCUS; + _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_PING] = + ECORE_X_ATOM_NET_WM_PING; + _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = + ECORE_X_ATOM_NET_WM_SYNC_REQUEST; _ecore_x_selection_data_init(); _ecore_x_dnd_init(); - + _ecore_x_init_count++; - + _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456); - + return _ecore_x_init_count; } @@ -452,8 +503,10 @@ static int _ecore_x_shutdown(int close_display) { _ecore_x_init_count--; - if (_ecore_x_init_count > 0) return _ecore_x_init_count; - if (!_ecore_x_disp) return _ecore_x_init_count; + if (_ecore_x_init_count > 0) + return _ecore_x_init_count; + if (!_ecore_x_disp) + return _ecore_x_init_count; if (close_display) XCloseDisplay(_ecore_x_disp); else @@ -467,7 +520,8 @@ _ecore_x_shutdown(int close_display) _ecore_x_event_handlers = NULL; _ecore_x_selection_shutdown(); _ecore_x_dnd_shutdown(); - if (_ecore_x_init_count < 0) _ecore_x_init_count = 0; + if (_ecore_x_init_count < 0) + _ecore_x_init_count = 0; return _ecore_x_init_count; } @@ -511,10 +565,10 @@ ecore_x_disconnect(void) * @return The current X display. * @ingroup Ecore_X_Display_Attr_Group */ -Ecore_X_Display * +Ecore_X_Display * ecore_x_display_get(void) { - return (Ecore_X_Display *)_ecore_x_disp; + return (Ecore_X_Display *) _ecore_x_disp; } /** @@ -541,7 +595,8 @@ ecore_x_fd_get(void) void ecore_x_double_click_time_set(double t) { - if (t < 0.0) t = 0.0; + if (t < 0.0) + t = 0.0; _ecore_x_double_click_time = t; } @@ -599,32 +654,32 @@ ecore_x_sync(void) void ecore_x_killall(Ecore_X_Window root) { - int screens; - int i, j; - + int screens; + int i, j; + XGrabServer(_ecore_x_disp); screens = ScreenCount(_ecore_x_disp); /* Tranverse window tree starting from root, and drag each * before the firing squad */ for (i = 0; i < screens; ++i) - { - Window root_r; - Window parent_r; - Window *children_r = NULL; - unsigned int num_children = 0; - - while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r, - &children_r, &num_children) && (num_children > 0)) - { - for (j = 0; j < num_children; ++j) - { - XKillClient(_ecore_x_disp, children_r[j]); - } - - XFree(children_r); - } - } + { + Window root_r; + Window parent_r; + Window *children_r = NULL; + unsigned int num_children = 0; + + while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r, + &children_r, &num_children) && (num_children > 0)) + { + for (j = 0; j < num_children; ++j) + { + XKillClient(_ecore_x_disp, children_r[j]); + } + + XFree(children_r); + } + } XUngrabServer(_ecore_x_disp); XSync(_ecore_x_disp, False); @@ -653,32 +708,33 @@ ecore_x_current_time_get(void) } static int -_ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) +_ecore_x_fd_handler(void *data, Ecore_Fd_Handler * fd_handler __UNUSED__) { - Display *d; - + Display *d; + d = data; while (XPending(d)) { - XEvent ev; - + XEvent ev; + XNextEvent(d, &ev); if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num)) { if (_ecore_x_event_handlers[ev.type]) - _ecore_x_event_handlers[ev.type] (&ev); + _ecore_x_event_handlers[ev.type] (&ev); } } return 1; } static int -_ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) +_ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler * fd_handler __UNUSED__) { - Display *d; + Display *d; d = data; - if (XPending(d)) return 1; + if (XPending(d)) + return 1; return 0; } @@ -688,12 +744,11 @@ _ecore_x_key_mask_get(KeySym sym) XModifierKeymap *mod; KeySym sym2; int i, j; - const int masks[8] = - { - ShiftMask, LockMask, ControlMask, - Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask - }; - + const int masks[8] = { + ShiftMask, LockMask, ControlMask, + Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask + }; + mod = XGetModifierMapping(_ecore_x_disp); if ((mod) && (mod->max_keypermod > 0)) { @@ -701,15 +756,18 @@ _ecore_x_key_mask_get(KeySym sym) { for (j = 0; j < 8; j++) { - sym2 = XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j); - if (sym2 != 0) break; + sym2 = + XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j); + if (sym2 != 0) + break; } if (sym2 == sym) { - int mask; - + int mask; + mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) XFree(mod->modifiermap); + if (mod->modifiermap) + XFree(mod->modifiermap); XFree(mod); return mask; } @@ -717,38 +775,41 @@ _ecore_x_key_mask_get(KeySym sym) } if (mod) { - if (mod->modifiermap) XFree(mod->modifiermap); + if (mod->modifiermap) + XFree(mod->modifiermap); XFree(mod); } - return 0; + return 0; } typedef struct _Ecore_X_Filter_Data Ecore_X_Filter_Data; struct _Ecore_X_Filter_Data { - int last_event_type; + int last_event_type; }; -static void * +static void * _ecore_x_event_filter_start(void *data __UNUSED__) { Ecore_X_Filter_Data *filter_data; - + filter_data = calloc(1, sizeof(Ecore_X_Filter_Data)); return filter_data; } static int -_ecore_x_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__) +_ecore_x_event_filter_filter(void *data __UNUSED__, void *loop_data, int type, + void *event __UNUSED__) { Ecore_X_Filter_Data *filter_data; - + filter_data = loop_data; - if (!filter_data) return 1; + if (!filter_data) + return 1; if (type == ECORE_X_EVENT_MOUSE_MOVE) { - if ((filter_data->last_event_type) == ECORE_X_EVENT_MOUSE_MOVE) + if ((filter_data->last_event_type) == ECORE_X_EVENT_MOUSE_MOVE) { filter_data->last_event_type = type; return 0; @@ -762,32 +823,12 @@ static void _ecore_x_event_filter_end(void *data __UNUSED__, void *loop_data) { Ecore_X_Filter_Data *filter_data; - + filter_data = loop_data; - if (filter_data) free(filter_data); + if (filter_data) + free(filter_data); } - - - - - - - - - - - - - - - - - - - - - /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ @@ -803,25 +844,30 @@ _ecore_x_event_filter_end(void *data __UNUSED__, void *loop_data) * @param h Pointer to an integer into which the height is to be stored. */ void -ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h) +ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, + int *h) { - Window dummy_win; - int ret_x, ret_y; - unsigned int ret_w, ret_h, dummy_border, dummy_depth; + Window dummy_win; + int ret_x, ret_y; + unsigned int ret_w, ret_h, dummy_border, dummy_depth; if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y, - &ret_w, &ret_h, &dummy_border, &dummy_depth)) - { - ret_x = 0; - ret_y = 0; - ret_w = 0; - ret_h = 0; - } + &ret_w, &ret_h, &dummy_border, &dummy_depth)) + { + ret_x = 0; + ret_y = 0; + ret_w = 0; + ret_h = 0; + } - if (x) *x = ret_x; - if (y) *y = ret_y; - if (w) *w = (int) ret_w; - if (h) *h = (int) ret_h; + if (x) + *x = ret_x; + if (y) + *y = ret_y; + if (w) + *w = (int)ret_w; + if (h) + *h = (int)ret_h; } /** @@ -832,15 +878,15 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h int ecore_x_drawable_border_width_get(Ecore_X_Drawable d) { - Window dummy_win; - int dummy_x, dummy_y; - unsigned int dummy_w, dummy_h, border_ret, dummy_depth; + Window dummy_win; + int dummy_x, dummy_y; + unsigned int dummy_w, dummy_h, border_ret, dummy_depth; if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, - &dummy_w, &dummy_h, &border_ret, &dummy_depth)) + &dummy_w, &dummy_h, &border_ret, &dummy_depth)) border_ret = 0; - return (int) border_ret; + return (int)border_ret; } /** @@ -851,15 +897,15 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d) int ecore_x_drawable_depth_get(Ecore_X_Drawable d) { - Window dummy_win; - int dummy_x, dummy_y; - unsigned int dummy_w, dummy_h, dummy_border, depth_ret; + Window dummy_win; + int dummy_x, dummy_y; + unsigned int dummy_w, dummy_h, dummy_border, depth_ret; if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, - &dummy_w, &dummy_h, &dummy_border, &depth_ret)) + &dummy_w, &dummy_h, &dummy_border, &depth_ret)) depth_ret = 0; - return (int) depth_ret; + return (int)depth_ret; } /** @@ -870,92 +916,96 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d) * @return An array of all the root windows. @c NULL is returned if memory * could not be allocated for the list, or if @p num_ret is @c NULL. */ -Ecore_X_Window * +Ecore_X_Window * ecore_x_window_root_list(int *num_ret) { - int num, i; - Ecore_X_Window *roots; - - if (!num_ret) return NULL; + int num, i; + Ecore_X_Window *roots; + + if (!num_ret) + return NULL; *num_ret = 0; #ifdef ECORE_XPRINT - { - Screen **ps = NULL; - int psnum = 0; - - num = ScreenCount(_ecore_x_disp); - ps = XpQueryScreens(_ecore_x_disp, &psnum); - if (ps) - { - int overlap, j; - - overlap = 0; - for (i = 0; i < num; i++) - { - for (j = 0; j < psnum; j++) - { - if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) - overlap++; - } - } - roots = malloc((num - overlap) * sizeof(Window)); - if (roots) - { - int k; - - k = 0; - for (i = 0; i < num; i++) - { - int is_print; - - is_print = 0; - for (j = 0; j < psnum; j++) - { - if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) - { - is_print = 1; - break; - } - } - if (!is_print) - { - roots[k] = RootWindow(_ecore_x_disp, i); - k++; - } - } - *num_ret = k; - } - XFree(ps); - } - else - { - roots = malloc(num * sizeof(Window)); - if (!roots) return NULL; - *num_ret = num; - for (i = 0; i < num; i++) - roots[i] = RootWindow(_ecore_x_disp, i); - } - } -#else + { + Screen **ps = NULL; + int psnum = 0; + + num = ScreenCount(_ecore_x_disp); + ps = XpQueryScreens(_ecore_x_disp, &psnum); + if (ps) + { + int overlap, j; + + overlap = 0; + for (i = 0; i < num; i++) + { + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + overlap++; + } + } + roots = malloc((num - overlap) * sizeof(Window)); + if (roots) + { + int k; + + k = 0; + for (i = 0; i < num; i++) + { + int is_print; + + is_print = 0; + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + { + is_print = 1; + break; + } + } + if (!is_print) + { + roots[k] = RootWindow(_ecore_x_disp, i); + k++; + } + } + *num_ret = k; + } + XFree(ps); + } + else + { + roots = malloc(num * sizeof(Window)); + if (!roots) + return NULL; + *num_ret = num; + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); + } + } +#else num = ScreenCount(_ecore_x_disp); roots = malloc(num * sizeof(Window)); - if (!roots) return NULL; + if (!roots) + return NULL; *num_ret = num; for (i = 0; i < num; i++) - roots[i] = RootWindow(_ecore_x_disp, i); -#endif + roots[i] = RootWindow(_ecore_x_disp, i); +#endif return roots; } Ecore_X_Window ecore_x_window_root_first_get(void) { - int num; - Ecore_X_Window root, *roots = NULL; + int num; + Ecore_X_Window root, *roots = NULL; roots = ecore_x_window_root_list(&num); - if(!(roots)) return 0; - + if (!(roots)) + return 0; + if (num > 0) root = roots[0]; else @@ -965,38 +1015,36 @@ ecore_x_window_root_first_get(void) return root; } +static void _ecore_x_window_manage_error(void *data); -static void _ecore_x_window_manage_error(void *data); - -static int _ecore_x_window_manage_failed = 0; +static int _ecore_x_window_manage_failed = 0; static void _ecore_x_window_manage_error(void *data __UNUSED__) { if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) && (ecore_x_error_code_get() == BadAccess)) - _ecore_x_window_manage_failed = 1; + _ecore_x_window_manage_failed = 1; } int ecore_x_window_manage(Ecore_X_Window win) { XWindowAttributes att; - - if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True) return 0; + + if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True) + return 0; ecore_x_sync(); _ecore_x_window_manage_failed = 0; ecore_x_error_handler_set(_ecore_x_window_manage_error, NULL); - XSelectInput(_ecore_x_disp, win, - EnterWindowMask | - LeaveWindowMask | - PropertyChangeMask | + XSelectInput(_ecore_x_disp, win, + EnterWindowMask | + LeaveWindowMask | + PropertyChangeMask | ResizeRedirectMask | - SubstructureRedirectMask | + SubstructureRedirectMask | SubstructureNotifyMask | - StructureNotifyMask | - KeyPressMask | - KeyReleaseMask | - att.your_event_mask); + StructureNotifyMask | KeyPressMask | KeyReleaseMask | att. + your_event_mask); ecore_x_sync(); ecore_x_error_handler_set(NULL, NULL); if (_ecore_x_window_manage_failed) @@ -1010,23 +1058,20 @@ ecore_x_window_manage(Ecore_X_Window win) void ecore_x_window_container_manage(Ecore_X_Window win) { - XSelectInput(_ecore_x_disp, win, - ResizeRedirectMask | - SubstructureRedirectMask | + XSelectInput(_ecore_x_disp, win, + ResizeRedirectMask | SubstructureRedirectMask | SubstructureNotifyMask); } void ecore_x_window_client_manage(Ecore_X_Window win) { - XSelectInput(_ecore_x_disp, win, - PropertyChangeMask | + XSelectInput(_ecore_x_disp, win, + PropertyChangeMask | ResizeRedirectMask | FocusChangeMask | - ColormapChangeMask | - VisibilityChangeMask | - StructureNotifyMask - ); + ColormapChangeMask | VisibilityChangeMask | + StructureNotifyMask); XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); } @@ -1034,8 +1079,7 @@ void ecore_x_window_sniff(Ecore_X_Window win) { XSelectInput(_ecore_x_disp, win, - PropertyChangeMask | - SubstructureNotifyMask); + PropertyChangeMask | SubstructureNotifyMask); } void @@ -1044,8 +1088,7 @@ ecore_x_window_client_sniff(Ecore_X_Window win) XSelectInput(_ecore_x_disp, win, PropertyChangeMask | FocusChangeMask | - ColormapChangeMask | - VisibilityChangeMask | + ColormapChangeMask | VisibilityChangeMask | StructureNotifyMask); XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); } @@ -1055,24 +1098,22 @@ ecore_x_window_client_sniff(Ecore_X_Window win) * @param name The given name. * @return Associated atom value. */ -Ecore_X_Atom +Ecore_X_Atom ecore_x_atom_get(const char *name) { - if (!_ecore_x_disp) return 0; + if (!_ecore_x_disp) + return 0; return XInternAtom(_ecore_x_disp, name, False); } - - - - - int -ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret) +ecore_x_window_attributes_get(Ecore_X_Window win, + Ecore_X_Window_Attributes * att_ret) { - XWindowAttributes att; - - if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return 0; + XWindowAttributes att; + + if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) + return 0; memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes)); att_ret->root = att.root; att_ret->x = att.x; @@ -1081,11 +1122,16 @@ ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att att_ret->h = att.height; att_ret->border = att.border_width; att_ret->depth = att.depth; - if (att.map_state != IsUnmapped) att_ret->visible = 1; - if (att.map_state == IsViewable) att_ret->viewable = 1; - if (att.override_redirect) att_ret->override = 1; - if (att.class == InputOnly) att_ret->input_only = 1; - if (att.save_under) att_ret->save_under = 1; + if (att.map_state != IsUnmapped) + att_ret->visible = 1; + if (att.map_state == IsViewable) + att_ret->viewable = 1; + if (att.override_redirect) + att_ret->override = 1; + if (att.class == InputOnly) + att_ret->input_only = 1; + if (att.save_under) + att_ret->save_under = 1; att_ret->event_mask.mine = att.your_event_mask; att_ret->event_mask.all = att.your_event_mask; att_ret->event_mask.no_propagate = att.do_not_propagate_mask; @@ -1107,15 +1153,16 @@ ecore_x_window_save_set_del(Ecore_X_Window win) XRemoveFromSaveSet(_ecore_x_disp, win); } -Ecore_X_Window * +Ecore_X_Window * ecore_x_window_children_get(Ecore_X_Window win, int *num) { Ecore_X_Window *windows = NULL; Window root_ret = 0, parent_ret = 0, *children_ret = NULL; unsigned int children_ret_num = 0; - - if (!XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret, - &children_ret_num)) + + if (!XQueryTree + (_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret, + &children_ret_num)) { return NULL; } @@ -1124,10 +1171,10 @@ ecore_x_window_children_get(Ecore_X_Window win, int *num) windows = malloc(children_ret_num * sizeof(Ecore_X_Window)); if (windows) { - unsigned int i; - + unsigned int i; + for (i = 0; i < children_ret_num; i++) - windows[i] = children_ret[i]; + windows[i] = children_ret[i]; *num = children_ret_num; } XFree(children_ret); @@ -1135,11 +1182,6 @@ ecore_x_window_children_get(Ecore_X_Window win, int *num) return windows; } - - - - - int ecore_x_cursor_color_supported_get(void) { @@ -1147,30 +1189,31 @@ ecore_x_cursor_color_supported_get(void) } Ecore_X_Cursor -ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y) +ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, + int hot_y) { -#ifdef ECORE_XCURSOR +#ifdef ECORE_XCURSOR if (_ecore_x_xcursor) { - Cursor c; - XcursorImage *xci; - + Cursor c; + XcursorImage *xci; + xci = XcursorImageCreate(w, h); if (xci) { - int i; - + int i; + xci->xhot = hot_x; xci->yhot = hot_y; xci->delay = 0; for (i = 0; i < (w * h); i++) { - int r, g, b, a; - + int r, g, b, a; + a = (pixels[i] >> 24) & 0xff; r = (((pixels[i] >> 16) & 0xff) * a) / 0xff; - g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff; - b = (((pixels[i] ) & 0xff) * a) / 0xff; + g = (((pixels[i] >> 8) & 0xff) * a) / 0xff; + b = (((pixels[i]) & 0xff) * a) / 0xff; xci->pixels[i] = (a << 24) | (r << 16) | (g << 8) | (b); } c = XcursorImageLoadCursor(_ecore_x_disp, xci); @@ -1179,58 +1222,60 @@ ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int } } else -#endif +#endif { - XColor c1, c2; - Cursor c; - Pixmap pmap, mask; - GC gc; - XGCValues gcv; - XImage *xim; - unsigned int *pix; - int fr, fg, fb, br, bg, bb; - int brightest = 0; - int darkest = 255 * 3; - int x, y; - const int dither[2][2] = - { - {0, 2}, - {3, 1} - }; - - + XColor c1, c2; + Cursor c; + Pixmap pmap, mask; + GC gc; + XGCValues gcv; + XImage *xim; + unsigned int *pix; + int fr, fg, fb, br, bg, bb; + int brightest = 0; + int darkest = 255 * 3; + int x, y; + const int dither[2][2] = { + {0, 2}, + {3, 1} + }; + pmap = XCreatePixmap(_ecore_x_disp, win, w, h, 1); mask = XCreatePixmap(_ecore_x_disp, win, w, h, 1); - xim = XCreateImage(_ecore_x_disp, - DefaultVisual(_ecore_x_disp, 0), - 1, ZPixmap, 0, NULL, w, h, 32, 0); + xim = XCreateImage(_ecore_x_disp, + DefaultVisual(_ecore_x_disp, 0), 1, ZPixmap, 0, NULL, + w, h, 32, 0); xim->data = malloc(xim->bytes_per_line * xim->height); - - fr = 0x00; fg = 0x00; fb = 0x00; - br = 0xff; bg = 0xff; bb = 0xff; + + fr = 0x00; + fg = 0x00; + fb = 0x00; + br = 0xff; + bg = 0xff; + bb = 0xff; pix = pixels; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - int r, g, b, a; - + int r, g, b, a; + a = (pix[0] >> 24) & 0xff; r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8 ) & 0xff; - b = (pix[0] ) & 0xff; + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; if (a > 0) { if ((r + g + b) > brightest) { - brightest = r + g + b; + brightest = r + g + b; br = r; bg = g; bb = b; } if ((r + g + b) < darkest) { - darkest = r + g + b; + darkest = r + g + b; fr = r; fg = g; fb = b; @@ -1239,76 +1284,76 @@ ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int pix++; } } - + pix = pixels; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - int v; - int r, g, b; - int d1, d2; - + int v; + int r, g, b; + int d1, d2; + r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8 ) & 0xff; - b = (pix[0] ) & 0xff; - d1 = - ((r - fr) * (r - fr)) + - ((g - fg) * (g - fg)) + - ((b - fb) * (b - fb)); - d2 = - ((r - br) * (r - br)) + - ((g - bg) * (g - bg)) + - ((b - bb) * (b - bb)); + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; + d1 = + ((r - fr) * (r - fr)) + ((g - fg) * (g - fg)) + + ((b - fb) * (b - fb)); + d2 = + ((r - br) * (r - br)) + ((g - bg) * (g - bg)) + + ((b - bb) * (b - bb)); v = (((d2 * 255) / (d1 + d2)) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) v = 1; - else v = 0; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; XPutPixel(xim, x, y, v); pix++; } } gc = XCreateGC(_ecore_x_disp, pmap, 0, &gcv); - XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h); + XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h); XFreeGC(_ecore_x_disp, gc); - + pix = pixels; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - int v; - + int v; + v = (((pix[0] >> 24) & 0xff) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) v = 1; - else v = 0; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; XPutPixel(xim, x, y, v); pix++; } } gc = XCreateGC(_ecore_x_disp, mask, 0, &gcv); - XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h); + XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h); XFreeGC(_ecore_x_disp, gc); - + free(xim->data); xim->data = NULL; XDestroyImage(xim); - + c1.pixel = 0; - c1.red = fr << 8 | fr; + c1.red = fr << 8 | fr; c1.green = fg << 8 | fg; - c1.blue = fb << 8 | fb; + c1.blue = fb << 8 | fb; c1.flags = DoRed | DoGreen | DoBlue; - + c2.pixel = 0; - c2.red = br << 8 | br; + c2.red = br << 8 | br; c2.green = bg << 8 | bg; - c2.blue = bb << 8 | bb; - c2.flags = DoRed | DoGreen | DoBlue; - - c = XCreatePixmapCursor(_ecore_x_disp, - pmap, mask, - &c1, &c2, - hot_x, hot_y); + c2.blue = bb << 8 | bb; + c2.flags = DoRed | DoGreen | DoBlue; + + c = XCreatePixmapCursor(_ecore_x_disp, pmap, mask, &c1, &c2, hot_x, + hot_y); XFreePixmap(_ecore_x_disp, pmap); XFreePixmap(_ecore_x_disp, mask); return c; @@ -1338,20 +1383,18 @@ int ecore_x_pointer_grab(Ecore_X_Window win) { return XGrabPointer(_ecore_x_disp, win, False, - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - None, None, CurrentTime); + GrabModeAsync, GrabModeAsync, None, None, CurrentTime); } int ecore_x_pointer_confine_grab(Ecore_X_Window win) { return XGrabPointer(_ecore_x_disp, win, False, - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - win, None, CurrentTime); + GrabModeAsync, GrabModeAsync, win, None, CurrentTime); } void @@ -1369,21 +1412,21 @@ ecore_x_pointer_warp(Ecore_X_Window win, int x, int y) int ecore_x_keyboard_grab(Ecore_X_Window win) { - return XGrabKeyboard(_ecore_x_disp, win, False, - GrabModeAsync, GrabModeAsync, + return XGrabKeyboard(_ecore_x_disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); } -void ecore_x_keyboard_ungrab(void) +void +ecore_x_keyboard_ungrab(void) { - XUngrabKeyboard(_ecore_x_disp, CurrentTime); + XUngrabKeyboard(_ecore_x_disp, CurrentTime); } void ecore_x_grab(void) { _ecore_x_grab_count++; - + if (_ecore_x_grab_count == 1) XGrabServer(_ecore_x_disp); } @@ -1396,61 +1439,66 @@ ecore_x_ungrab(void) _ecore_x_grab_count = 0; if (_ecore_x_grab_count == 0) - { - XUngrabServer(_ecore_x_disp); - XSync(_ecore_x_disp, False); - } + { + XUngrabServer(_ecore_x_disp); + XSync(_ecore_x_disp, False); + } } -int _ecore_window_grabs_num = 0; -Window *_ecore_window_grabs = NULL; -int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event); -void *_ecore_window_grab_replay_data; +int _ecore_window_grabs_num = 0; +Window *_ecore_window_grabs = NULL; +int (*_ecore_window_grab_replay_func) (void *data, + int event_type, + void *event); +void *_ecore_window_grab_replay_data; void -ecore_x_passive_grab_replay_func_set(int (*func) (void *data, int event_type, void *event), void *data) +ecore_x_passive_grab_replay_func_set(int (*func) + (void *data, int event_type, void *event), + void *data) { _ecore_window_grab_replay_func = func; _ecore_window_grab_replay_data = data; } void -ecore_x_window_button_grab(Ecore_X_Window win, int button, - Ecore_X_Event_Mask event_mask, - int mod, int any_mod) +ecore_x_window_button_grab(Ecore_X_Window win, int button, + Ecore_X_Event_Mask event_mask, int mod, int any_mod) { unsigned int b; unsigned int m; unsigned int locks[8]; int i, ev; - + b = button; - if (b == 0) b = AnyButton; + if (b == 0) + b = AnyButton; m = mod; - if (any_mod) m = AnyModifier; + if (any_mod) + m = AnyModifier; locks[0] = 0; locks[1] = ECORE_X_LOCK_CAPS; locks[2] = ECORE_X_LOCK_NUM; locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; ev = event_mask; for (i = 0; i < 8; i++) - XGrabButton(_ecore_x_disp, b, m | locks[i], - win, False, ev, GrabModeSync, GrabModeAsync, None, None); + XGrabButton(_ecore_x_disp, b, m | locks[i], + win, False, ev, GrabModeSync, GrabModeAsync, None, None); _ecore_window_grabs_num++; - _ecore_window_grabs = realloc(_ecore_window_grabs, - _ecore_window_grabs_num * sizeof(Window)); + _ecore_window_grabs = + realloc(_ecore_window_grabs, _ecore_window_grabs_num * sizeof(Window)); _ecore_window_grabs[_ecore_window_grabs_num - 1] = win; } void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin) { - XEvent xev; - + XEvent xev; + xev.xclient.type = ClientMessage; xev.xclient.serial = 0; xev.xclient.send_event = True; @@ -1467,118 +1515,125 @@ _ecore_x_sync_magic_send(int val, Ecore_X_Window swin) void _ecore_x_window_grab_remove(Ecore_X_Window win) { - int i, shuffle = 0; - + int i, shuffle = 0; + if (_ecore_window_grabs_num > 0) { for (i = 0; i < _ecore_window_grabs_num; i++) { - if (shuffle) _ecore_window_grabs[i - 1] = _ecore_window_grabs[i]; + if (shuffle) + _ecore_window_grabs[i - 1] = _ecore_window_grabs[i]; if ((!shuffle) && (_ecore_window_grabs[i] == win)) - shuffle = 1; + shuffle = 1; } if (shuffle) { _ecore_window_grabs_num--; - _ecore_window_grabs = realloc(_ecore_window_grabs, - _ecore_window_grabs_num * sizeof(Window)); + _ecore_window_grabs = realloc(_ecore_window_grabs, + _ecore_window_grabs_num * + sizeof(Window)); } } } void -ecore_x_window_button_ungrab(Ecore_X_Window win, int button, - int mod, int any_mod) +ecore_x_window_button_ungrab(Ecore_X_Window win, int button, int mod, + int any_mod) { unsigned int b; unsigned int m; unsigned int locks[8]; int i; - + b = button; - if (b == 0) b = AnyButton; + if (b == 0) + b = AnyButton; m = mod; - if (any_mod) m = AnyModifier; + if (any_mod) + m = AnyModifier; locks[0] = 0; locks[1] = ECORE_X_LOCK_CAPS; locks[2] = ECORE_X_LOCK_NUM; locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; for (i = 0; i < 8; i++) - XUngrabButton(_ecore_x_disp, b, m | locks[i], win); + XUngrabButton(_ecore_x_disp, b, m | locks[i], win); _ecore_x_sync_magic_send(1, win); } -int _ecore_key_grabs_num = 0; -Window *_ecore_key_grabs = NULL; +int _ecore_key_grabs_num = 0; +Window *_ecore_key_grabs = NULL; void -ecore_x_window_key_grab(Ecore_X_Window win, char *key, - int mod, int any_mod) +ecore_x_window_key_grab(Ecore_X_Window win, char *key, int mod, int any_mod) { KeyCode keycode = 0; KeySym keysym; unsigned int m; unsigned int locks[8]; int i; - + if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); + keycode = atoi(key + 8); else { keysym = XStringToKeysym(key); - if (keysym == NoSymbol) return; - keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); + if (keysym == NoSymbol) + return; + keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); } - if (keycode == 0) return; - + if (keycode == 0) + return; + m = mod; - if (any_mod) m = AnyModifier; + if (any_mod) + m = AnyModifier; locks[0] = 0; locks[1] = ECORE_X_LOCK_CAPS; locks[2] = ECORE_X_LOCK_NUM; locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; for (i = 0; i < 8; i++) - XGrabKey(_ecore_x_disp, keycode, m | locks[i], - win, True, GrabModeSync, GrabModeAsync); + XGrabKey(_ecore_x_disp, keycode, m | locks[i], win, True, GrabModeSync, + GrabModeAsync); _ecore_key_grabs_num++; - _ecore_key_grabs = realloc(_ecore_key_grabs, - _ecore_key_grabs_num * sizeof(Window)); + _ecore_key_grabs = + realloc(_ecore_key_grabs, _ecore_key_grabs_num * sizeof(Window)); _ecore_key_grabs[_ecore_key_grabs_num - 1] = win; } void _ecore_x_key_grab_remove(Ecore_X_Window win) { - int i, shuffle = 0; - + int i, shuffle = 0; + if (_ecore_key_grabs_num > 0) { for (i = 0; i < _ecore_key_grabs_num; i++) { - if (shuffle) _ecore_key_grabs[i - 1] = _ecore_key_grabs[i]; + if (shuffle) + _ecore_key_grabs[i - 1] = _ecore_key_grabs[i]; if ((!shuffle) && (_ecore_key_grabs[i] == win)) - shuffle = 1; + shuffle = 1; } if (shuffle) { _ecore_key_grabs_num--; - _ecore_key_grabs = realloc(_ecore_key_grabs, - _ecore_key_grabs_num * sizeof(Window)); + _ecore_key_grabs = + realloc(_ecore_key_grabs, + _ecore_key_grabs_num * sizeof(Window)); } } } void -ecore_x_window_key_ungrab(Ecore_X_Window win, char *key, - int mod, int any_mod) +ecore_x_window_key_ungrab(Ecore_X_Window win, char *key, int mod, int any_mod) { KeyCode keycode = 0; KeySym keysym; @@ -1587,27 +1642,30 @@ ecore_x_window_key_ungrab(Ecore_X_Window win, char *key, int i; if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); + keycode = atoi(key + 8); else { keysym = XStringToKeysym(key); - if (keysym == NoSymbol) return; - keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); + if (keysym == NoSymbol) + return; + keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); } - if (keycode == 0) return; - + if (keycode == 0) + return; + m = mod; - if (any_mod) m = AnyModifier; + if (any_mod) + m = AnyModifier; locks[0] = 0; locks[1] = ECORE_X_LOCK_CAPS; locks[2] = ECORE_X_LOCK_NUM; locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; for (i = 0; i < 8; i++) - XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win); + XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win); _ecore_x_sync_magic_send(2, win); } @@ -1626,22 +1684,22 @@ ecore_x_window_key_ungrab(Ecore_X_Window win, char *key, */ int ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, - Ecore_X_Event_Mask mask, - long d0, long d1, long d2, long d3, long d4) + Ecore_X_Event_Mask mask, long d0, long d1, + long d2, long d3, long d4) { - XEvent xev; - - xev.xclient.window = win; - xev.xclient.type = ClientMessage; - xev.xclient.message_type = type; - xev.xclient.format = 32; - xev.xclient.data.l[0] = d0; - xev.xclient.data.l[1] = d1; - xev.xclient.data.l[2] = d2; - xev.xclient.data.l[3] = d3; - xev.xclient.data.l[4] = d4; - - return XSendEvent(_ecore_x_disp, win, False, mask, &xev); + XEvent xev; + + xev.xclient.window = win; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = type; + xev.xclient.format = 32; + xev.xclient.data.l[0] = d0; + xev.xclient.data.l[1] = d1; + xev.xclient.data.l[2] = d2; + xev.xclient.data.l[3] = d3; + xev.xclient.data.l[4] = d4; + + return XSendEvent(_ecore_x_disp, win, False, mask, &xev); } /** @@ -1658,18 +1716,18 @@ int ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type, const void *data, int len) { - XEvent xev; - - xev.xclient.window = win; - xev.xclient.type = ClientMessage; - xev.xclient.message_type = type; - xev.xclient.format = 8; - if (len > 20) - len = 20; - memcpy(xev.xclient.data.b, data, len); - memset(xev.xclient.data.b + len, 0, 20 - len); - - return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); + XEvent xev; + + xev.xclient.window = win; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = type; + xev.xclient.format = 8; + if (len > 20) + len = 20; + memcpy(xev.xclient.data.b, data, len); + memset(xev.xclient.data.b + len, 0, 20 - len); + + return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); } void @@ -1687,20 +1745,24 @@ ecore_x_events_allow_all(void) void ecore_x_pointer_last_xy_get(int *x, int *y) { - if (x) *x = _ecore_x_event_last_root_x; - if (y) *y = _ecore_x_event_last_root_y; + if (x) + *x = _ecore_x_event_last_root_x; + if (y) + *y = _ecore_x_event_last_root_y; } void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y) { - Window rwin, cwin; - int rx, ry, wx, wy; - unsigned int mask; - + Window rwin, cwin; + int rx, ry, wx, wy; + unsigned int mask; + XQueryPointer(_ecore_x_disp, win, &rwin, &cwin, &rx, &ry, &wx, &wy, &mask); - if (x) *x = wx; - if (y) *y = wy; + if (x) + *x = wx; + if (y) + *y = wy; } /*****************************************************************************/ /*****************************************************************************/ -- cgit v1.2.3