2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef HAVE_CONFIG_H */
|
2009-01-31 10:33:39 -08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2010-01-03 13:55:50 -08:00
|
|
|
#include <stdio.h>
|
2009-02-19 14:25:07 -08:00
|
|
|
#include <string.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
|
2007-12-15 17:41:15 -08:00
|
|
|
#include <langinfo.h>
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#include "Ecore.h"
|
2009-12-22 13:15:12 -08:00
|
|
|
#include "ecore_private.h"
|
2003-09-23 01:09:32 -07:00
|
|
|
#include "ecore_x_private.h"
|
|
|
|
#include "Ecore_X.h"
|
2004-12-04 02:10:29 -08:00
|
|
|
#include "Ecore_X_Atoms.h"
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2006-02-17 20:35:43 -08:00
|
|
|
/** OpenBSD does not define CODESET
|
|
|
|
* FIXME ??
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CODESET
|
|
|
|
#define CODESET "INVALID"
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifndef CODESET */
|
2006-02-17 20:35:43 -08:00
|
|
|
|
2011-08-29 22:15:53 -07:00
|
|
|
typedef struct _Ecore_X_Mouse_Down_Info
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
2011-10-20 22:40:59 -07:00
|
|
|
int dev;
|
|
|
|
Window last_win;
|
|
|
|
Window last_last_win;
|
|
|
|
Window last_event_win;
|
|
|
|
Window last_last_event_win;
|
|
|
|
Time last_time;
|
|
|
|
Time last_last_time;
|
2011-08-29 22:15:53 -07:00
|
|
|
Eina_Bool did_double : 1;
|
|
|
|
Eina_Bool did_triple : 1;
|
|
|
|
} Ecore_X_Mouse_Down_Info;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
static Eina_Bool _ecore_x_last_event_mouse_move = EINA_FALSE;
|
|
|
|
static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL;
|
|
|
|
static Ecore_Event_Mouse_Move *_ecore_x_last_event_mouse_move_event_e = NULL;
|
|
|
|
static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL;
|
2011-08-29 22:15:53 -07:00
|
|
|
|
2016-04-05 06:11:29 -07:00
|
|
|
#ifdef ECORE_XKB
|
|
|
|
static Eina_Hash *emitted_events = NULL;
|
|
|
|
#endif
|
|
|
|
|
2011-08-29 22:15:53 -07:00
|
|
|
static void
|
|
|
|
_ecore_x_mouse_down_info_clear(void)
|
|
|
|
{
|
|
|
|
Eina_Inlist *l = _ecore_x_mouse_down_info_list;
|
|
|
|
Ecore_X_Mouse_Down_Info *info = NULL;
|
|
|
|
while (l)
|
|
|
|
{
|
|
|
|
info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info);
|
|
|
|
l = eina_inlist_remove(l, l);
|
|
|
|
free(info);
|
|
|
|
}
|
|
|
|
_ecore_x_mouse_down_info_list = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_events_init(void)
|
|
|
|
{
|
2011-10-20 22:40:59 -07:00
|
|
|
//Actually, Nothing to do.
|
2016-04-05 06:11:29 -07:00
|
|
|
#ifdef ECORE_XKB
|
|
|
|
emitted_events = eina_hash_int64_new(NULL);
|
|
|
|
#endif
|
2011-08-29 22:15:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_events_shutdown(void)
|
|
|
|
{
|
|
|
|
_ecore_x_mouse_down_info_clear();
|
2016-04-05 06:11:29 -07:00
|
|
|
#ifdef ECORE_XKB
|
|
|
|
eina_hash_free(emitted_events);
|
|
|
|
#endif
|
2011-08-29 22:15:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Ecore_X_Mouse_Down_Info *
|
|
|
|
_ecore_x_mouse_down_info_get(int dev)
|
|
|
|
{
|
|
|
|
Eina_Inlist *l = _ecore_x_mouse_down_info_list;
|
|
|
|
Ecore_X_Mouse_Down_Info *info = NULL;
|
|
|
|
|
|
|
|
//Return the exist info
|
|
|
|
EINA_INLIST_FOREACH(l, info)
|
|
|
|
if (info->dev == dev) return info;
|
|
|
|
|
2011-10-20 22:40:59 -07:00
|
|
|
//New Device. Add it.
|
2011-08-29 22:15:53 -07:00
|
|
|
info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info));
|
|
|
|
if (!info) return NULL;
|
|
|
|
|
|
|
|
info->dev = dev;
|
2011-10-20 22:40:59 -07:00
|
|
|
l = eina_inlist_append(l, (Eina_Inlist *)info);
|
2011-08-29 22:15:53 -07:00
|
|
|
_ecore_x_mouse_down_info_list = l;
|
|
|
|
return info;
|
|
|
|
}
|
2006-08-25 10:27:08 -07:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_x_event_free_mouse_move(void *data EINA_UNUSED,
|
2011-10-20 22:40:59 -07:00
|
|
|
void *ev)
|
2009-03-16 09:24:43 -07:00
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Move *e;
|
|
|
|
|
|
|
|
e = ev;
|
|
|
|
if (_ecore_x_last_event_mouse_move)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_x_last_event_mouse_move_event = NULL;
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move_event_e = NULL;
|
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2009-03-16 09:24:43 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
free(e);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2011-12-03 12:05:48 -08:00
|
|
|
ecore_x_event_mask_set(Ecore_X_Window w,
|
2011-10-20 22:40:59 -07:00
|
|
|
Ecore_X_Event_Mask mask)
|
2004-01-21 21:23:33 -08:00
|
|
|
{
|
2004-04-23 15:17:01 -07:00
|
|
|
XWindowAttributes attr;
|
2004-04-23 15:48:21 -07:00
|
|
|
XSetWindowAttributes s_attr;
|
2004-04-23 15:17:01 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-23 05:39:09 -08:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
|
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!w)
|
2011-10-20 22:40:59 -07:00
|
|
|
w = DefaultRootWindow(_ecore_x_disp);
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2004-04-23 15:17:01 -07:00
|
|
|
memset(&attr, 0, sizeof(XWindowAttributes));
|
|
|
|
XGetWindowAttributes(_ecore_x_disp, w, &attr);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2004-04-23 15:48:21 -07:00
|
|
|
s_attr.event_mask = mask | attr.your_event_mask;
|
|
|
|
XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2004-04-23 15:48:21 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2011-12-03 12:05:48 -08:00
|
|
|
ecore_x_event_mask_unset(Ecore_X_Window w,
|
2011-10-20 22:40:59 -07:00
|
|
|
Ecore_X_Event_Mask mask)
|
2004-04-23 15:48:21 -07:00
|
|
|
{
|
|
|
|
XWindowAttributes attr;
|
|
|
|
XSetWindowAttributes s_attr;
|
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-23 05:39:09 -08:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
|
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!w)
|
2011-10-20 22:40:59 -07:00
|
|
|
w = DefaultRootWindow(_ecore_x_disp);
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2004-04-23 15:48:21 -07:00
|
|
|
memset(&attr, 0, sizeof(XWindowAttributes));
|
|
|
|
XGetWindowAttributes(_ecore_x_disp, w, &attr);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2004-04-23 15:48:21 -07:00
|
|
|
s_attr.event_mask = attr.your_event_mask & ~mask;
|
|
|
|
XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2004-01-21 21:23:33 -08:00
|
|
|
|
2004-01-16 16:14:37 -08:00
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_x_event_free_xdnd_enter(void *data EINA_UNUSED,
|
2011-10-20 22:40:59 -07:00
|
|
|
void *ev)
|
2004-01-16 16:14:37 -08:00
|
|
|
{
|
2005-03-24 07:45:33 -08:00
|
|
|
Ecore_X_Event_Xdnd_Enter *e;
|
|
|
|
int i;
|
2004-01-16 16:14:37 -08:00
|
|
|
|
|
|
|
e = ev;
|
2005-03-24 07:45:33 -08:00
|
|
|
for (i = 0; i < e->num_types; i++)
|
2011-10-20 22:40:59 -07:00
|
|
|
XFree(e->types[i]);
|
2005-03-24 07:45:33 -08:00
|
|
|
free(e->types);
|
2004-01-16 16:14:37 -08:00
|
|
|
free(e);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2004-01-16 16:14:37 -08:00
|
|
|
|
2005-03-23 02:53:34 -08:00
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_x_event_free_selection_notify(void *data EINA_UNUSED,
|
2011-10-20 22:40:59 -07:00
|
|
|
void *ev)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2005-03-24 07:45:33 -08:00
|
|
|
Ecore_X_Event_Selection_Notify *e;
|
2005-04-10 03:20:18 -07:00
|
|
|
Ecore_X_Selection_Data *sel;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
|
|
|
e = ev;
|
2005-04-10 03:20:18 -07:00
|
|
|
sel = e->data;
|
2010-07-27 22:23:42 -07:00
|
|
|
if (sel->free)
|
2011-10-20 22:40:59 -07:00
|
|
|
sel->free(sel);
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-03-24 07:45:33 -08:00
|
|
|
free(e->target);
|
2005-03-23 02:53:34 -08:00
|
|
|
free(e);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
static unsigned int
|
|
|
|
_ecore_x_event_modifiers(unsigned int state)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
unsigned int modifiers = 0;
|
|
|
|
|
|
|
|
if (state & ECORE_X_MODIFIER_SHIFT)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (state & ECORE_X_MODIFIER_CTRL)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_MODIFIER_CTRL;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (state & ECORE_X_MODIFIER_ALT)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_MODIFIER_ALT;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (state & ECORE_X_MODIFIER_WIN)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_MODIFIER_WIN;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2012-06-28 00:30:32 -07:00
|
|
|
if (state & ECORE_X_MODIFIER_ALTGR)
|
|
|
|
modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
|
2012-06-27 03:47:57 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (state & ECORE_X_LOCK_SCROLL)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_LOCK_SCROLL;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (state & ECORE_X_LOCK_NUM)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_LOCK_NUM;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (state & ECORE_X_LOCK_CAPS)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_LOCK_CAPS;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2011-07-14 08:37:04 -07:00
|
|
|
if (state & ECORE_X_LOCK_SHIFT)
|
2011-10-20 22:40:59 -07:00
|
|
|
modifiers |= ECORE_EVENT_LOCK_SHIFT;
|
2011-07-14 08:37:04 -07:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
return modifiers;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
void
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_mouse_move(unsigned int timestamp,
|
|
|
|
unsigned int xmodifiers,
|
2011-12-03 12:05:48 -08:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int x_root,
|
|
|
|
int y_root,
|
2010-07-27 22:23:42 -07:00
|
|
|
unsigned int event_window,
|
|
|
|
unsigned int window,
|
|
|
|
unsigned int root_win,
|
2011-12-03 12:05:48 -08:00
|
|
|
int same_screen,
|
|
|
|
int dev,
|
|
|
|
double radx,
|
|
|
|
double rady,
|
|
|
|
double pressure,
|
|
|
|
double angle,
|
|
|
|
double mx,
|
|
|
|
double my,
|
|
|
|
double mrx,
|
|
|
|
double mry)
|
2009-03-16 09:24:43 -07:00
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Move *e;
|
|
|
|
Ecore_Event *event;
|
|
|
|
|
2016-04-20 05:33:20 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
e->window = window;
|
|
|
|
e->root_window = root_win;
|
|
|
|
e->timestamp = timestamp;
|
|
|
|
e->same_screen = same_screen;
|
|
|
|
e->event_window = event_window;
|
|
|
|
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xmodifiers);
|
|
|
|
e->x = x;
|
|
|
|
e->y = y;
|
|
|
|
e->root.x = x_root;
|
|
|
|
e->root.y = y_root;
|
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
e->multi.device = dev;
|
|
|
|
e->multi.radius = (radx + rady) / 2;
|
|
|
|
e->multi.radius_x = radx;
|
|
|
|
e->multi.radius_y = rady;
|
|
|
|
e->multi.pressure = pressure;
|
|
|
|
e->multi.angle = angle;
|
|
|
|
e->multi.x = mx;
|
|
|
|
e->multi.y = my;
|
|
|
|
e->multi.root.x = mrx;
|
|
|
|
e->multi.root.y = mry;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE,
|
|
|
|
e,
|
|
|
|
_ecore_x_event_free_mouse_move,
|
|
|
|
NULL);
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
_ecore_x_event_last_time = timestamp;
|
|
|
|
_ecore_x_event_last_win = window;
|
|
|
|
_ecore_x_event_last_root_x = x_root;
|
|
|
|
_ecore_x_event_last_root_y = y_root;
|
|
|
|
|
|
|
|
_ecore_x_last_event_mouse_move_event = event;
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move_event_e = e;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
static void
|
2014-11-24 23:07:09 -08:00
|
|
|
_ecore_x_event_free_axis_update_event(void *data EINA_UNUSED, void *ev)
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
{
|
|
|
|
Ecore_Event_Axis_Update *e = ev;
|
|
|
|
if (e) free(e->axis);
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_axis_update(Ecore_Window window,
|
|
|
|
Ecore_Window event_window,
|
|
|
|
Ecore_Window root_window,
|
|
|
|
unsigned int timestamp,
|
|
|
|
int devid,
|
|
|
|
int toolid,
|
|
|
|
int naxis,
|
|
|
|
Ecore_Axis *axis)
|
|
|
|
{
|
|
|
|
Ecore_Event_Axis_Update *e;
|
|
|
|
int i;
|
|
|
|
|
2016-04-20 05:33:20 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_Event_Axis_Update));
|
2015-04-20 18:32:40 -07:00
|
|
|
if (!e)
|
|
|
|
{
|
|
|
|
if (axis) free(axis);
|
|
|
|
return;
|
|
|
|
}
|
Expose device (e.g. pen) axis information to applications
Summary:
This patch set adds the necessary code to expose device axis state to applications. This was primarily written with graphics tablets in mind, which -- in addition to acting like a mouse -- also provide information about pen pressure, tilt, etc. Other devices could potentially benefit from this API as well: touchscreens, joysticks, knob controllers, "spaceballs", etc.
Whenever an update to the device state is recieved, an "Axis update" event is synthesized. This event contains the updated information, typically scaled and normalized to a particular logical range (e.g. zero to one for pressure, -pi to pi radians for angles, etc.). Information about the tool which generated the event is also stored so that applications can disambiguate events from multiple devices (or in the case of multitouch screens, individual fingers).
This API is only wired up for use with X11 at the moment. Support for other backends (e.g. Wayland) should be easy to add for those familiar them.
**Note**: The following is a list of changes from the "v2" patches originally sent to the mailinglist
//Define and implement new Ecore_Event_Axis_Update events//
* Harcode axis labels instead of including xserver-properties.h
* Use C89-style comments
* Use doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Create "Ecore_Axis" and "Ecore_Axis_Label" typedefs
* Reference typedef'd instead of raw types
* Adjust how we count through valuators to support tilt/az
* Add support for tilt and azimuth
* Tweak memory management in case number of valuators differ
* Expand TWIST axis normalization to declared range
* Only normalize TWIST axis if resolution == 1 (wacom bug)
* Cache label atoms on first use to minimize round-trips
//Implement EVAS_CALLBACK_AXIS_UPDATE event and friends//
* Update to doxygen comments
* Update comment text to note axes with unbounded/undefined ranges/units
* Typedef 'Evas_Axis_Label', 'Evas_Axis'
* Move typedef for 'Evas_Event_Axis_Update'
* Reference typedef'd instead of raw types
//Wire the Ecore and Evas implementations of axis update events together//
* Expose ecore_event_evas_axis_update in Ecore_Input_Evas.h
* Move ecore_event_evas_axis_update to more logical position
//DEBUG: Add axis update logging to evas-multi-touch.c//
* Removed from patch set
//Make evas-multi-touch demo use new axis functionality//
* Have pressure adjust rectangle brightness instead of size
* Use more available axis data when rendering rectangle (azimuth, tilt, twist)
Test Plan: The evas-multi-touch demo was updated to support axis update events. A graphics tablet was then used to verify that the pressure, azimuth, tilt, and twist data was coming through correctly.
Reviewers: cedric, raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1514
Conflicts:
src/lib/ecore_input/Ecore_Input.h
Carsten Haitzler -
** fixed forward enum typedefs (make things unhappy)
** fixed conflict above
** fixed wrong param type for _evas_canvas_event_feed_axis_update()
** fixed @sinces to be 1.13
** fixed formatting/indeting
** fixed order of operation reliance in if's with ()'s to be clear
** fixed functions to be static that should have been
2014-11-24 19:07:50 -08:00
|
|
|
|
|
|
|
e->window = window;
|
|
|
|
e->event_window = event_window;
|
|
|
|
e->root_window = root_window;
|
|
|
|
|
|
|
|
e->timestamp = timestamp;
|
|
|
|
|
|
|
|
e->device = devid;
|
|
|
|
e->toolid = toolid;
|
|
|
|
|
|
|
|
e->naxis = naxis;
|
|
|
|
e->axis = axis;
|
|
|
|
|
|
|
|
INF("Axis update [%d] (%d) with %d events:", ECORE_EVENT_AXIS_UPDATE, e->device, e->naxis);
|
|
|
|
for (i = 0; i < naxis; i++)
|
|
|
|
{
|
|
|
|
INF("AXIS %d = %f", e->axis[i].label, e->axis[i].value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_EVENT_AXIS_UPDATE, e, _ecore_x_event_free_axis_update_event, NULL);
|
|
|
|
|
|
|
|
_ecore_x_event_last_time = timestamp;
|
|
|
|
}
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
static void
|
2011-12-03 12:05:48 -08:00
|
|
|
_ecore_key_press(int event,
|
2011-10-20 22:40:59 -07:00
|
|
|
XKeyEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Key *e;
|
2009-12-21 08:17:29 -08:00
|
|
|
char *compose = NULL;
|
2009-03-16 09:24:43 -07:00
|
|
|
char *tmp = NULL;
|
|
|
|
char *keyname;
|
2016-12-14 20:18:39 -08:00
|
|
|
char *key = NULL;
|
2009-03-16 09:24:43 -07:00
|
|
|
char keyname_buffer[256];
|
|
|
|
char compose_buffer[256];
|
2016-05-27 07:55:24 -07:00
|
|
|
KeySym sym, sym2 = 0;
|
2009-01-03 20:43:54 -08:00
|
|
|
XComposeStatus status;
|
2009-03-16 09:24:43 -07:00
|
|
|
int val;
|
2015-10-15 02:29:51 -07:00
|
|
|
int key_len, keyname_len, compose_len;
|
2005-09-24 02:00:23 -07:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2016-05-27 07:55:24 -07:00
|
|
|
sym = _ecore_x_XKeycodeToKeysym(xevent->display, xevent->keycode, 0);
|
|
|
|
keyname = XKeysymToString(sym);
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
if (!keyname)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
snprintf(keyname_buffer,
|
|
|
|
sizeof(keyname_buffer),
|
|
|
|
"Keycode-%i",
|
|
|
|
xevent->keycode);
|
|
|
|
keyname = keyname_buffer;
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
key = NULL;
|
|
|
|
compose = NULL;
|
2011-07-11 19:26:19 -07:00
|
|
|
val = XLookupString(xevent,
|
|
|
|
compose_buffer,
|
|
|
|
sizeof(compose_buffer),
|
2016-05-27 07:55:24 -07:00
|
|
|
&sym2,
|
2011-07-11 19:26:19 -07:00
|
|
|
&status);
|
2016-12-14 20:18:39 -08:00
|
|
|
|
|
|
|
if (sym != sym2)
|
|
|
|
key = XKeysymToString(sym2);
|
|
|
|
if (!key)
|
|
|
|
key = keyname;
|
|
|
|
|
2011-07-11 19:26:19 -07:00
|
|
|
if (val > 0)
|
2011-10-20 22:40:59 -07:00
|
|
|
{
|
|
|
|
compose_buffer[val] = 0;
|
|
|
|
compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
|
|
|
|
compose_buffer);
|
2011-11-22 03:08:45 -08:00
|
|
|
if (!compose)
|
|
|
|
ERR("Ecore_X cannot convert input key string '%s' to UTF-8. "
|
|
|
|
"Is Eina built with iconv support?", compose_buffer);
|
2011-10-20 22:40:59 -07:00
|
|
|
tmp = compose;
|
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2015-10-15 02:29:51 -07:00
|
|
|
key_len = strlen(key);
|
|
|
|
keyname_len = strlen(keyname);
|
|
|
|
compose_len = (compose) ? strlen(compose) : 0;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_Event_Key) + key_len + keyname_len +
|
|
|
|
compose_len + 3);
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
goto on_error;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->keyname = (char *)(e + 1);
|
2015-10-15 02:29:51 -07:00
|
|
|
e->key = e->keyname + keyname_len + 1;
|
|
|
|
e->compose = (compose) ? e->key + key_len + 1 : NULL;
|
2009-03-16 09:24:43 -07:00
|
|
|
e->string = e->compose;
|
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
strcpy((char *)e->keyname, keyname);
|
2011-10-20 22:40:59 -07:00
|
|
|
strcpy((char *)e->key, key);
|
2010-07-27 22:23:42 -07:00
|
|
|
if (compose)
|
2011-10-20 22:40:59 -07:00
|
|
|
strcpy((char *)e->compose, compose);
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xevent->state);
|
|
|
|
|
|
|
|
e->timestamp = xevent->time;
|
|
|
|
e->window = xevent->subwindow ? xevent->subwindow : xevent->window;
|
|
|
|
e->event_window = xevent->window;
|
|
|
|
e->same_screen = xevent->same_screen;
|
|
|
|
e->root_window = xevent->root;
|
2014-05-06 05:09:20 -07:00
|
|
|
e->keycode = xevent->keycode;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
ecore_event_add(event, e, NULL, NULL);
|
|
|
|
|
|
|
|
_ecore_x_event_last_time = e->timestamp;
|
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
on_error:
|
|
|
|
if (tmp)
|
2011-10-20 22:40:59 -07:00
|
|
|
free(tmp);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
Ecore_Event_Mouse_Button *
|
2011-12-03 12:05:48 -08:00
|
|
|
_ecore_mouse_button(int event,
|
2010-07-27 22:23:42 -07:00
|
|
|
unsigned int timestamp,
|
|
|
|
unsigned int xmodifiers,
|
|
|
|
unsigned int buttons,
|
2011-12-03 12:05:48 -08:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int x_root,
|
|
|
|
int y_root,
|
2010-07-27 22:23:42 -07:00
|
|
|
unsigned int event_window,
|
|
|
|
unsigned int window,
|
|
|
|
unsigned int root_win,
|
2011-12-03 12:05:48 -08:00
|
|
|
int same_screen,
|
|
|
|
int dev,
|
|
|
|
double radx,
|
|
|
|
double rady,
|
|
|
|
double pressure,
|
|
|
|
double angle,
|
|
|
|
double mx,
|
|
|
|
double my,
|
|
|
|
double mrx,
|
|
|
|
double mry)
|
2009-03-16 09:24:43 -07:00
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Button *e;
|
|
|
|
|
2016-04-20 05:33:20 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return NULL;
|
2009-03-16 09:24:43 -07:00
|
|
|
|
|
|
|
e->window = window;
|
|
|
|
e->root_window = root_win;
|
|
|
|
e->timestamp = timestamp;
|
|
|
|
e->same_screen = same_screen;
|
|
|
|
e->event_window = event_window;
|
|
|
|
|
|
|
|
e->buttons = buttons;
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xmodifiers);
|
|
|
|
e->double_click = 0;
|
|
|
|
e->triple_click = 0;
|
|
|
|
e->x = x;
|
|
|
|
e->y = y;
|
|
|
|
e->root.x = x_root;
|
|
|
|
e->root.y = y_root;
|
|
|
|
|
2011-08-29 22:15:53 -07:00
|
|
|
Ecore_X_Mouse_Down_Info *down_info = _ecore_x_mouse_down_info_get(dev);
|
|
|
|
|
|
|
|
if (down_info)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2015-06-15 23:33:43 -07:00
|
|
|
//If mouse cancel event occred, should reset down info related with double & triple click
|
|
|
|
if (event == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
|
|
|
|
{
|
|
|
|
down_info->last_win = 0;
|
|
|
|
down_info->last_last_win = 0;
|
|
|
|
down_info->last_event_win = 0;
|
|
|
|
down_info->last_last_event_win = 0;
|
|
|
|
down_info->last_time = 0;
|
|
|
|
down_info->last_last_time = 0;
|
|
|
|
down_info->did_double = EINA_FALSE;
|
|
|
|
down_info->did_triple = EINA_FALSE;
|
|
|
|
}
|
2011-08-29 22:15:53 -07:00
|
|
|
if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
|
|
|
|
down_info->did_triple)
|
2011-04-20 07:15:33 -07:00
|
|
|
{
|
2011-08-29 22:15:53 -07:00
|
|
|
down_info->last_win = 0;
|
|
|
|
down_info->last_last_win = 0;
|
|
|
|
down_info->last_event_win = 0;
|
|
|
|
down_info->last_last_event_win = 0;
|
|
|
|
down_info->last_time = 0;
|
|
|
|
down_info->last_last_time = 0;
|
|
|
|
}
|
|
|
|
if (event_window == window)
|
|
|
|
{
|
|
|
|
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
|
2010-10-04 00:58:06 -07:00
|
|
|
{
|
2011-12-03 12:05:48 -08:00
|
|
|
//Check Double Clicked
|
|
|
|
if (((int)(timestamp - down_info->last_time) <=
|
|
|
|
(int)(1000 * _ecore_x_double_click_time)) &&
|
|
|
|
(window == down_info->last_win) &&
|
|
|
|
(event_window == down_info->last_event_win))
|
|
|
|
{
|
|
|
|
e->double_click = 1;
|
|
|
|
down_info->did_double = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
down_info->did_double = EINA_FALSE;
|
|
|
|
down_info->did_triple = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Check Triple Clicked
|
|
|
|
if (((int)(timestamp - down_info->last_last_time) <=
|
|
|
|
(int)(2 * 1000 * _ecore_x_double_click_time)) &&
|
|
|
|
(window == down_info->last_win) &&
|
|
|
|
(window == down_info->last_last_win) &&
|
|
|
|
(event_window == down_info->last_event_win) &&
|
|
|
|
(event_window == down_info->last_last_event_win)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
e->triple_click = 1;
|
|
|
|
down_info->did_triple = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
down_info->did_triple = EINA_FALSE;
|
|
|
|
}
|
2010-10-04 00:58:06 -07:00
|
|
|
}
|
2015-06-15 23:33:43 -07:00
|
|
|
else if (event == ECORE_EVENT_MOUSE_BUTTON_UP)
|
2010-10-04 00:58:06 -07:00
|
|
|
{
|
2011-08-29 22:15:53 -07:00
|
|
|
if (down_info->did_double)
|
|
|
|
e->double_click = 1;
|
|
|
|
if (down_info->did_triple)
|
|
|
|
e->triple_click = 1;
|
2010-10-04 00:58:06 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-03-21 07:43:21 -07:00
|
|
|
|
2011-04-20 07:15:33 -07:00
|
|
|
/* NB: Block commented out as _ecore_x_mouse_up_count appears to have
|
|
|
|
* no use. The variable is also commented out above. This code block is
|
|
|
|
* the only place that this variable is used, and appears to serve no
|
2011-03-21 07:43:21 -07:00
|
|
|
* purpose. - dh
|
2011-10-20 22:40:59 -07:00
|
|
|
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
|
2009-03-16 09:24:43 -07:00
|
|
|
&& !e->double_click
|
|
|
|
&& !e->triple_click)
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_x_mouse_up_count = 0;
|
2011-03-21 07:43:21 -07:00
|
|
|
*/
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-01-17 00:52:38 -08:00
|
|
|
e->multi.device = dev;
|
|
|
|
e->multi.radius = (radx + rady) / 2;
|
|
|
|
e->multi.radius_x = radx;
|
|
|
|
e->multi.radius_y = rady;
|
|
|
|
e->multi.pressure = pressure;
|
|
|
|
e->multi.angle = angle;
|
|
|
|
e->multi.x = mx;
|
|
|
|
e->multi.y = my;
|
|
|
|
e->multi.root.x = mrx;
|
|
|
|
e->multi.root.y = mry;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
_ecore_x_event_last_time = e->timestamp;
|
|
|
|
_ecore_x_event_last_win = e->window;
|
|
|
|
_ecore_x_event_last_root_x = x_root;
|
|
|
|
_ecore_x_event_last_root_y = y_root;
|
|
|
|
|
|
|
|
ecore_event_add(event, e, NULL, NULL);
|
|
|
|
|
2011-08-29 22:15:53 -07:00
|
|
|
if ((down_info) &&
|
|
|
|
(event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
|
|
|
|
(window == event_window) &&
|
|
|
|
(!down_info->did_triple))
|
|
|
|
{
|
|
|
|
down_info->last_last_win = down_info->last_win;
|
|
|
|
down_info->last_win = window;
|
|
|
|
down_info->last_last_event_win = down_info->last_event_win;
|
|
|
|
down_info->last_event_win = event_window;
|
|
|
|
down_info->last_last_time = down_info->last_time;
|
|
|
|
down_info->last_time = timestamp;
|
|
|
|
}
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
return e;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2009-04-16 10:29:00 -07:00
|
|
|
void
|
|
|
|
_ecore_x_event_handle_any_event(XEvent *xevent)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
XEvent *ev = malloc(sizeof(XEvent));
|
2011-01-03 22:10:31 -08:00
|
|
|
if (!ev) return;
|
2009-04-16 10:29:00 -07:00
|
|
|
memcpy(ev, xevent, sizeof(XEvent));
|
|
|
|
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-04-16 10:29:00 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void
|
2009-03-16 09:24:43 -07:00
|
|
|
_ecore_x_event_handle_key_press(XEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-01-03 20:43:54 -08:00
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
void
|
|
|
|
_ecore_x_event_handle_key_release(XEvent *xevent)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_button_press(XEvent *xevent)
|
|
|
|
{
|
2004-12-03 19:54:04 -08:00
|
|
|
int i;
|
2005-07-10 00:34:10 -07:00
|
|
|
|
2013-01-26 01:47:21 -08:00
|
|
|
INF("ButtonEvent:press time=%u x=%d y=%d button=%d", (unsigned int)xevent->xbutton.time, (int)xevent->xbutton.x, (int)xevent->xbutton.y, xevent->xbutton.button);
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-07-30 04:43:17 -07:00
|
|
|
if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8))
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_Event_Mouse_Wheel *e;
|
|
|
|
|
2016-04-20 05:33:20 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->timestamp = xevent->xbutton.time;
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state);
|
|
|
|
switch (xevent->xbutton.button)
|
|
|
|
{
|
|
|
|
case 4: e->direction = 0; e->z = -1; break;
|
|
|
|
|
|
|
|
case 5: e->direction = 0; e->z = 1; break;
|
|
|
|
|
|
|
|
case 6: e->direction = 1; e->z = -1; break;
|
|
|
|
|
|
|
|
case 7: e->direction = 1; e->z = 1; break;
|
|
|
|
|
2009-04-19 01:37:08 -07:00
|
|
|
default: e->direction = 0; e->z = 0; break;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->x = xevent->xbutton.x;
|
|
|
|
e->y = xevent->xbutton.y;
|
|
|
|
e->root.x = xevent->xbutton.x_root;
|
|
|
|
e->root.y = xevent->xbutton.y_root;
|
|
|
|
|
|
|
|
if (xevent->xbutton.subwindow)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->window = xevent->xbutton.subwindow;
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->window = xevent->xbutton.window;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->event_window = xevent->xbutton.window;
|
|
|
|
e->same_screen = xevent->xbutton.same_screen;
|
|
|
|
e->root_window = xevent->xbutton.root;
|
|
|
|
|
|
|
|
_ecore_x_event_last_time = e->timestamp;
|
|
|
|
_ecore_x_event_last_win = e->window;
|
|
|
|
_ecore_x_event_last_root_x = xevent->xbutton.x_root;
|
|
|
|
_ecore_x_event_last_root_y = xevent->xbutton.y_root;
|
|
|
|
ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < _ecore_window_grabs_num; i++)
|
|
|
|
{
|
2014-07-04 02:02:10 -07:00
|
|
|
if ((_ecore_window_grabs[i].win == xevent->xbutton.window) ||
|
|
|
|
(_ecore_window_grabs[i].win == xevent->xbutton.subwindow))
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
|
|
|
Eina_Bool replay = EINA_FALSE;
|
|
|
|
|
|
|
|
if (_ecore_window_grab_replay_func)
|
2011-10-20 22:40:59 -07:00
|
|
|
replay = _ecore_window_grab_replay_func(
|
|
|
|
_ecore_window_grab_replay_data,
|
|
|
|
ECORE_EVENT_MOUSE_WHEEL,
|
|
|
|
e);
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (replay)
|
2011-10-20 22:40:59 -07:00
|
|
|
XAllowEvents(xevent->xbutton.display,
|
|
|
|
ReplayPointer, xevent->xbutton.time);
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
XAllowEvents(xevent->xbutton.display,
|
|
|
|
AsyncPointer, xevent->xbutton.time);
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
|
|
|
_ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
|
|
|
xevent->xbutton.window,
|
|
|
|
(xevent->xbutton.subwindow ? xevent->xbutton.
|
|
|
|
subwindow : xevent->xbutton.window),
|
|
|
|
xevent->xbutton.root,
|
|
|
|
xevent->xbutton.same_screen,
|
2010-01-17 00:52:38 -08:00
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root);
|
2010-07-27 22:23:42 -07:00
|
|
|
}
|
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Button *e;
|
|
|
|
int event_window;
|
|
|
|
int window;
|
|
|
|
|
|
|
|
window =
|
2011-10-20 22:40:59 -07:00
|
|
|
(xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent->
|
|
|
|
xbutton.window);
|
2010-07-27 22:23:42 -07:00
|
|
|
event_window = xevent->xbutton.window;
|
|
|
|
|
|
|
|
e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
|
|
|
xevent->xbutton.time,
|
|
|
|
xevent->xbutton.state,
|
|
|
|
xevent->xbutton.button,
|
|
|
|
xevent->xbutton.x,
|
|
|
|
xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root,
|
|
|
|
xevent->xbutton.y_root,
|
|
|
|
event_window,
|
|
|
|
window,
|
|
|
|
xevent->xbutton.root,
|
|
|
|
xevent->xbutton.same_screen,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1.0,
|
2010-07-28 10:35:31 -07:00
|
|
|
// pressure
|
2010-07-27 22:23:42 -07:00
|
|
|
0.0,
|
2010-07-28 10:35:31 -07:00
|
|
|
// angle
|
2010-07-27 22:23:42 -07:00
|
|
|
xevent->xbutton.x,
|
|
|
|
xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root,
|
|
|
|
xevent->xbutton.y_root);
|
|
|
|
if (e)
|
2011-10-20 22:40:59 -07:00
|
|
|
for (i = 0; i < _ecore_window_grabs_num; i++)
|
|
|
|
{
|
2014-07-04 02:02:10 -07:00
|
|
|
if ((_ecore_window_grabs[i].win == xevent->xbutton.window) ||
|
|
|
|
(_ecore_window_grabs[i].win == xevent->xbutton.subwindow))
|
2011-10-20 22:40:59 -07:00
|
|
|
{
|
|
|
|
Eina_Bool replay = EINA_FALSE;
|
|
|
|
|
|
|
|
if (_ecore_window_grab_replay_func)
|
|
|
|
replay = _ecore_window_grab_replay_func(
|
|
|
|
_ecore_window_grab_replay_data,
|
|
|
|
ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
|
|
|
e);
|
|
|
|
|
|
|
|
if (replay)
|
|
|
|
XAllowEvents(xevent->xbutton.display,
|
|
|
|
ReplayPointer, xevent->xbutton.time);
|
|
|
|
else
|
|
|
|
XAllowEvents(xevent->xbutton.display,
|
|
|
|
AsyncPointer, xevent->xbutton.time);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_button_release(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2013-01-26 01:47:21 -08:00
|
|
|
INF("ButtonEvent:release time=%u x=%d y=%d button=%d", (unsigned int)xevent->xbutton.time, (int)xevent->xbutton.x, (int)xevent->xbutton.y, xevent->xbutton.button);
|
2003-09-23 01:09:32 -07:00
|
|
|
/* filter out wheel buttons */
|
2006-11-11 17:32:30 -08:00
|
|
|
if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7))
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state,
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
|
|
|
xevent->xbutton.window,
|
|
|
|
(xevent->xbutton.subwindow ? xevent->xbutton.
|
|
|
|
subwindow : xevent->xbutton.window),
|
|
|
|
xevent->xbutton.root,
|
|
|
|
xevent->xbutton.same_screen,
|
2010-01-17 00:52:38 -08:00
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root);
|
2009-03-16 09:24:43 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
|
|
xevent->xbutton.time, xevent->xbutton.state,
|
|
|
|
xevent->xbutton.button,
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root,
|
|
|
|
xevent->xbutton.window,
|
|
|
|
(xevent->xbutton.subwindow ? xevent->xbutton.
|
|
|
|
subwindow : xevent->xbutton.window),
|
|
|
|
xevent->xbutton.root,
|
|
|
|
xevent->xbutton.same_screen,
|
2010-01-17 00:52:38 -08:00
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xbutton.x, xevent->xbutton.y,
|
|
|
|
xevent->xbutton.x_root, xevent->xbutton.y_root);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_motion_notify(XEvent *xevent)
|
|
|
|
{
|
2009-02-09 03:16:56 -08:00
|
|
|
if (_ecore_x_last_event_mouse_move)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
Ecore_Event_Mouse_Move *e = _ecore_x_last_event_mouse_move_event_e;
|
|
|
|
|
|
|
|
if ((e) &&
|
|
|
|
(xevent->xmotion.window == e->event_window) &&
|
|
|
|
(xevent->xmotion.root == e->root_window) &&
|
|
|
|
(xevent->xmotion.same_screen == e->same_screen) &&
|
|
|
|
(_ecore_x_event_modifiers(xevent->xmotion.state) == e->modifiers))
|
|
|
|
{
|
|
|
|
if (((xevent->xmotion.subwindow) &&
|
|
|
|
(xevent->xmotion.subwindow == e->window)) ||
|
|
|
|
((!xevent->xmotion.subwindow) &&
|
|
|
|
(xevent->xmotion.window == e->window)))
|
|
|
|
{
|
|
|
|
// XXX: shouldn't we store event history in the new event
|
|
|
|
// with prior x,y,timestamp (all else assumed the same)
|
|
|
|
ecore_event_del(_ecore_x_last_event_mouse_move_event);
|
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
|
|
|
_ecore_x_last_event_mouse_move_event = NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-02-09 03:16:56 -08:00
|
|
|
}
|
2019-06-18 03:21:13 -07:00
|
|
|
|
2011-12-03 12:05:48 -08:00
|
|
|
_ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state,
|
|
|
|
xevent->xmotion.x, xevent->xmotion.y,
|
|
|
|
xevent->xmotion.x_root, xevent->xmotion.y_root,
|
|
|
|
xevent->xmotion.window,
|
|
|
|
(xevent->xmotion.subwindow ? xevent->xmotion.subwindow :
|
|
|
|
xevent->xmotion.window),
|
|
|
|
xevent->xmotion.root,
|
|
|
|
xevent->xmotion.same_screen,
|
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xmotion.x, xevent->xmotion.y,
|
|
|
|
xevent->xmotion.x_root, xevent->xmotion.y_root);
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_TRUE;
|
2011-12-03 12:05:48 -08:00
|
|
|
|
|
|
|
/* Xdnd handling */
|
|
|
|
_ecore_x_dnd_drag(xevent->xmotion.root,
|
|
|
|
xevent->xmotion.x_root,
|
|
|
|
xevent->xmotion.y_root);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_enter_notify(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
|
|
|
_ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
|
|
|
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
|
|
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
|
|
|
|
xevent->xcrossing.window,
|
|
|
|
(xevent->xcrossing.subwindow ? xevent->xcrossing.
|
|
|
|
subwindow : xevent->xcrossing.window),
|
|
|
|
xevent->xcrossing.root,
|
|
|
|
xevent->xcrossing.same_screen,
|
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
|
|
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Mouse_In *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
|
|
|
|
e->x = xevent->xcrossing.x;
|
|
|
|
e->y = xevent->xcrossing.y;
|
|
|
|
e->root.x = xevent->xcrossing.x_root;
|
|
|
|
e->root.y = xevent->xcrossing.y_root;
|
|
|
|
if (xevent->xcrossing.subwindow)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->win = xevent->xcrossing.subwindow;
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->win = xevent->xcrossing.window;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->same_screen = xevent->xcrossing.same_screen;
|
|
|
|
e->root_win = xevent->xcrossing.root;
|
|
|
|
e->event_win = xevent->xcrossing.window;
|
|
|
|
|
|
|
|
if (xevent->xcrossing.mode == NotifyNormal)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_NORMAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.mode == NotifyGrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_GRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.mode == NotifyUngrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_UNGRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (xevent->xcrossing.detail == NotifyAncestor)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyInferior)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyNonlinear)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->time = xevent->xcrossing.time;
|
|
|
|
_ecore_x_event_last_time = e->time;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
|
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_leave_notify(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
|
|
|
_ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state,
|
|
|
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
|
|
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root,
|
|
|
|
xevent->xcrossing.window,
|
|
|
|
(xevent->xcrossing.subwindow ? xevent->xcrossing.
|
|
|
|
subwindow : xevent->xcrossing.window),
|
|
|
|
xevent->xcrossing.root,
|
|
|
|
xevent->xcrossing.same_screen,
|
|
|
|
0, 1, 1,
|
|
|
|
1.0, // pressure
|
|
|
|
0.0, // angle
|
|
|
|
xevent->xcrossing.x, xevent->xcrossing.y,
|
|
|
|
xevent->xcrossing.x_root, xevent->xcrossing.y_root);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Mouse_Out *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state);
|
|
|
|
e->x = xevent->xcrossing.x;
|
|
|
|
e->y = xevent->xcrossing.y;
|
|
|
|
e->root.x = xevent->xcrossing.x_root;
|
|
|
|
e->root.y = xevent->xcrossing.y_root;
|
|
|
|
if (xevent->xcrossing.subwindow)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->win = xevent->xcrossing.subwindow;
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->win = xevent->xcrossing.window;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->same_screen = xevent->xcrossing.same_screen;
|
|
|
|
e->root_win = xevent->xcrossing.root;
|
|
|
|
e->event_win = xevent->xcrossing.window;
|
|
|
|
|
|
|
|
if (xevent->xcrossing.mode == NotifyNormal)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_NORMAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.mode == NotifyGrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_GRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.mode == NotifyUngrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_UNGRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (xevent->xcrossing.detail == NotifyAncestor)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyInferior)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyNonlinear)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->time = xevent->xcrossing.time;
|
|
|
|
_ecore_x_event_last_time = e->time;
|
|
|
|
_ecore_x_event_last_win = e->win;
|
|
|
|
_ecore_x_event_last_root_x = e->root.x;
|
|
|
|
_ecore_x_event_last_root_y = e->root.y;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL);
|
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_focus_in(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Focus_In *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xfocus.window;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (xevent->xfocus.mode == NotifyNormal)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_NORMAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyWhileGrabbed)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyGrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_GRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyUngrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_UNGRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (xevent->xfocus.detail == NotifyAncestor)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyInferior)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyNonlinear)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyPointer)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_POINTER;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyPointerRoot)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyDetailNone)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2004-05-09 01:15:34 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_focus_out(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Focus_Out *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xfocus.window;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
if (xevent->xfocus.mode == NotifyNormal)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_NORMAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyWhileGrabbed)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyGrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_GRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.mode == NotifyUngrab)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->mode = ECORE_X_EVENT_MODE_UNGRAB;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (xevent->xfocus.detail == NotifyAncestor)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyInferior)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyNonlinear)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyNonlinearVirtual)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyPointer)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_POINTER;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyPointerRoot)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xfocus.detail == NotifyDetailNone)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_x_event_handle_keymap_notify(XEvent *xevent EINA_UNUSED)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
/* FIXME: handle this event type */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_expose(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Damage *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xexpose.window;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
|
|
|
e->x = xevent->xexpose.x;
|
|
|
|
e->y = xevent->xexpose.y;
|
|
|
|
e->w = xevent->xexpose.width;
|
|
|
|
e->h = xevent->xexpose.height;
|
2006-05-18 23:05:35 -07:00
|
|
|
e->count = xevent->xexpose.count;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_graphics_expose(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Damage *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xgraphicsexpose.drawable;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
|
|
|
e->x = xevent->xgraphicsexpose.x;
|
|
|
|
e->y = xevent->xgraphicsexpose.y;
|
|
|
|
e->w = xevent->xgraphicsexpose.width;
|
|
|
|
e->h = xevent->xgraphicsexpose.height;
|
2006-05-18 23:05:35 -07:00
|
|
|
e->count = xevent->xgraphicsexpose.count;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_visibility_notify(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2007-09-27 08:43:08 -07:00
|
|
|
// if (xevent->xvisibility.state != VisibilityPartiallyObscured)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Visibility_Change *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xvisibility.window;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
|
|
|
if (xevent->xvisibility.state == VisibilityFullyObscured)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->fully_obscured = 1;
|
2003-09-23 01:09:32 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->fully_obscured = 0;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2004-05-09 01:15:34 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_create_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Create *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xcreatewindow.window;
|
2010-01-06 06:14:23 -08:00
|
|
|
e->parent = xevent->xcreatewindow.parent;
|
2003-09-23 01:09:32 -07:00
|
|
|
if (xevent->xcreatewindow.override_redirect)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->override = 1;
|
2003-09-23 01:09:32 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->override = 0;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-01-06 06:14:23 -08:00
|
|
|
e->x = xevent->xcreatewindow.x;
|
|
|
|
e->y = xevent->xcreatewindow.y;
|
|
|
|
e->w = xevent->xcreatewindow.width;
|
|
|
|
e->h = xevent->xcreatewindow.height;
|
|
|
|
e->border = xevent->xcreatewindow.border_width;
|
2003-09-23 01:09:32 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_destroy_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Destroy *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = xevent->xdestroywindow.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->event_win = xevent->xdestroywindow.event;
|
2003-09-23 01:09:32 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-07-27 22:23:42 -07:00
|
|
|
if (e->win == _ecore_x_event_last_win)
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_event_last_win = 0;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
|
2014-07-04 02:02:10 -07:00
|
|
|
while (_ecore_x_window_grab_remove(e->win, -1, 0, 0));
|
|
|
|
while (_ecore_x_key_grab_remove(e->win, NULL, 0, 0));
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_unmap_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Hide *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xunmap.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->event_win = xevent->xunmap.event;
|
2003-11-23 22:19:56 -08:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2013-01-29 00:23:40 -08:00
|
|
|
e->send_event = xevent->xunmap.send_event;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_map_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Show *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xmap.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->event_win = xevent->xmap.event;
|
2003-11-23 22:19:56 -08:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_map_request(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Show_Request *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xmaprequest.window;
|
2003-11-23 22:19:56 -08:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2003-09-23 01:09:32 -07:00
|
|
|
e->parent = xevent->xmaprequest.parent;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_reparent_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Reparent *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xreparent.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->event_win = xevent->xreparent.event;
|
2003-09-23 01:09:32 -07:00
|
|
|
e->parent = xevent->xreparent.parent;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_configure_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Configure *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xconfigure.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->event_win = xevent->xconfigure.event;
|
2003-09-23 01:09:32 -07:00
|
|
|
e->abovewin = xevent->xconfigure.above;
|
|
|
|
e->x = xevent->xconfigure.x;
|
|
|
|
e->y = xevent->xconfigure.y;
|
|
|
|
e->w = xevent->xconfigure.width;
|
|
|
|
e->h = xevent->xconfigure.height;
|
|
|
|
e->border = xevent->xconfigure.border_width;
|
|
|
|
e->override = xevent->xconfigure.override_redirect;
|
|
|
|
e->from_wm = xevent->xconfigure.send_event;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_configure_request(XEvent *xevent)
|
|
|
|
{
|
2004-08-27 15:33:56 -07:00
|
|
|
Ecore_X_Event_Window_Configure_Request *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2004-08-27 15:33:56 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2004-08-27 15:33:56 -07:00
|
|
|
e->win = xevent->xconfigurerequest.window;
|
2008-09-19 02:29:27 -07:00
|
|
|
e->parent_win = xevent->xconfigurerequest.parent;
|
2004-08-27 15:33:56 -07:00
|
|
|
e->abovewin = xevent->xconfigurerequest.above;
|
|
|
|
e->x = xevent->xconfigurerequest.x;
|
|
|
|
e->y = xevent->xconfigurerequest.y;
|
|
|
|
e->w = xevent->xconfigurerequest.width;
|
|
|
|
e->h = xevent->xconfigurerequest.height;
|
|
|
|
e->border = xevent->xconfigurerequest.border_width;
|
|
|
|
e->value_mask = xevent->xconfigurerequest.value_mask;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2005-05-02 00:13:52 -07:00
|
|
|
if (xevent->xconfigurerequest.detail == Above)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_ABOVE;
|
2005-05-02 00:13:52 -07:00
|
|
|
else if (xevent->xconfigurerequest.detail == Below)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_BELOW;
|
2005-05-02 00:13:52 -07:00
|
|
|
else if (xevent->xconfigurerequest.detail == TopIf)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
|
2005-05-02 00:13:52 -07:00
|
|
|
else if (xevent->xconfigurerequest.detail == BottomIf)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
|
2005-05-02 00:13:52 -07:00
|
|
|
else if (xevent->xconfigurerequest.detail == Opposite)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_x_event_handle_gravity_notify(XEvent *xevent EINA_UNUSED)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
/* FIXME: handle this event type */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_resize_request(XEvent *xevent)
|
|
|
|
{
|
2004-08-27 15:33:56 -07:00
|
|
|
Ecore_X_Event_Window_Resize_Request *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2004-08-27 15:33:56 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2004-08-27 15:33:56 -07:00
|
|
|
e->win = xevent->xresizerequest.window;
|
|
|
|
e->w = xevent->xresizerequest.width;
|
|
|
|
e->h = xevent->xresizerequest.height;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2005-08-22 20:47:55 -07:00
|
|
|
_ecore_x_event_handle_circulate_notify(XEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2005-08-22 20:47:55 -07:00
|
|
|
Ecore_X_Event_Window_Stack *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-08-22 20:47:55 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-08-22 20:47:55 -07:00
|
|
|
e->win = xevent->xcirculate.window;
|
|
|
|
e->event_win = xevent->xcirculate.event;
|
|
|
|
if (xevent->xcirculate.place == PlaceOnTop)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_ABOVE;
|
2005-08-22 20:47:55 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_BELOW;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-08-22 20:47:55 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2005-08-22 20:47:55 -07:00
|
|
|
_ecore_x_event_handle_circulate_request(XEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2005-08-22 20:47:55 -07:00
|
|
|
Ecore_X_Event_Window_Stack_Request *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-08-22 20:47:55 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-08-22 20:47:55 -07:00
|
|
|
e->win = xevent->xcirculaterequest.window;
|
|
|
|
e->parent = xevent->xcirculaterequest.parent;
|
|
|
|
if (xevent->xcirculaterequest.place == PlaceOnTop)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_ABOVE;
|
2005-08-22 20:47:55 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->detail = ECORE_X_WINDOW_STACK_BELOW;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-08-22 20:47:55 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_property_notify(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Property *e;
|
|
|
|
|
2010-02-18 18:27:18 -08:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Property));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xproperty.window;
|
|
|
|
e->atom = xevent->xproperty.atom;
|
|
|
|
e->time = xevent->xproperty.time;
|
2015-08-10 10:17:33 -07:00
|
|
|
e->state = !!xevent->xproperty.state;
|
2003-09-23 01:09:32 -07:00
|
|
|
_ecore_x_event_last_time = e->time;
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_selection_clear(XEvent *xevent)
|
|
|
|
{
|
2015-11-09 15:04:27 -08:00
|
|
|
Ecore_X_Selection_Intern *d;
|
2011-12-03 12:05:48 -08:00
|
|
|
Ecore_X_Event_Selection_Clear *e;
|
|
|
|
Ecore_X_Atom sel;
|
2004-01-10 13:01:18 -08:00
|
|
|
|
2011-12-03 12:05:48 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2011-01-13 23:03:33 -08:00
|
|
|
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
|
2015-11-09 15:04:27 -08:00
|
|
|
if (d && (xevent->xselectionclear.time <= d->time)) return;
|
|
|
|
/* errr..... why? paranoia.
|
2009-03-22 11:19:17 -07:00
|
|
|
if (d && (xevent->xselectionclear.time > d->time))
|
2005-03-23 10:33:50 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
_ecore_x_selection_set(None, NULL, 0,
|
|
|
|
xevent->xselectionclear.selection);
|
2005-03-23 10:33:50 -08:00
|
|
|
}
|
2010-07-07 23:53:06 -07:00
|
|
|
*/
|
2010-07-27 22:23:42 -07:00
|
|
|
/* Generate event for app cleanup */
|
2011-12-03 12:05:48 -08:00
|
|
|
e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
|
|
|
|
e->win = xevent->xselectionclear.window;
|
|
|
|
e->time = xevent->xselectionclear.time;
|
|
|
|
e->atom = sel = xevent->xselectionclear.selection;
|
|
|
|
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
|
|
|
|
e->selection = ECORE_X_SELECTION_PRIMARY;
|
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
|
|
|
|
e->selection = ECORE_X_SELECTION_SECONDARY;
|
2014-01-09 22:46:15 -08:00
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_XDND)
|
|
|
|
e->selection = ECORE_X_SELECTION_XDND;
|
2011-12-03 12:05:48 -08:00
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
|
|
|
|
e->selection = ECORE_X_SELECTION_CLIPBOARD;
|
|
|
|
else
|
|
|
|
e->selection = ECORE_X_SELECTION_OTHER;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_selection_request(XEvent *xevent)
|
|
|
|
{
|
2009-01-03 21:03:12 -08:00
|
|
|
Ecore_X_Event_Selection_Request *e;
|
|
|
|
Ecore_X_Selection_Intern *sd;
|
2011-05-03 02:46:55 -07:00
|
|
|
void *data = NULL;
|
2010-06-09 02:40:37 -07:00
|
|
|
int len;
|
|
|
|
int typesize;
|
2004-01-10 13:01:18 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2006-12-01 22:37:51 -08:00
|
|
|
/*
|
|
|
|
* Generate a selection request event.
|
|
|
|
*/
|
|
|
|
e = malloc(sizeof(Ecore_X_Event_Selection_Request));
|
2006-12-11 15:05:48 -08:00
|
|
|
e->owner = xevent->xselectionrequest.owner;
|
|
|
|
e->requestor = xevent->xselectionrequest.requestor;
|
2006-12-01 22:37:51 -08:00
|
|
|
e->time = xevent->xselectionrequest.time;
|
|
|
|
e->selection = xevent->xselectionrequest.selection;
|
2006-12-18 22:51:51 -08:00
|
|
|
e->target = xevent->xselectionrequest.target;
|
2006-12-01 22:37:51 -08:00
|
|
|
e->property = xevent->xselectionrequest.property;
|
2006-12-18 22:51:51 -08:00
|
|
|
ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL);
|
2006-12-01 22:37:51 -08:00
|
|
|
|
2006-12-11 15:05:48 -08:00
|
|
|
if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) &&
|
2005-10-08 06:51:58 -07:00
|
|
|
(sd->win == xevent->xselectionrequest.owner))
|
2005-03-23 10:33:50 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Selection_Intern *si;
|
|
|
|
|
|
|
|
si = _ecore_x_selection_get(xevent->xselectionrequest.selection);
|
|
|
|
if (si->data)
|
|
|
|
{
|
2011-05-23 00:51:44 -07:00
|
|
|
Ecore_X_Atom property = None;
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Atom type;
|
|
|
|
|
|
|
|
/* Set up defaults for strings first */
|
|
|
|
type = xevent->xselectionrequest.target;
|
|
|
|
typesize = 8;
|
|
|
|
len = sd->length;
|
|
|
|
|
|
|
|
if (!ecore_x_selection_convert(xevent->xselectionrequest.selection,
|
|
|
|
xevent->xselectionrequest.target,
|
|
|
|
&data, &len, &type, &typesize))
|
2011-10-20 22:40:59 -07:00
|
|
|
/* Refuse selection, conversion to requested target failed */
|
|
|
|
property = None;
|
2011-05-03 02:46:55 -07:00
|
|
|
else if (data)
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
2011-12-03 12:05:48 -08:00
|
|
|
/* FIXME: This does not properly handle large data transfers */
|
|
|
|
ecore_x_window_prop_property_set(
|
|
|
|
xevent->xselectionrequest.requestor,
|
|
|
|
xevent->xselectionrequest.
|
|
|
|
property,
|
|
|
|
type,
|
|
|
|
typesize,
|
|
|
|
data,
|
|
|
|
len);
|
|
|
|
property = xevent->xselectionrequest.property;
|
|
|
|
free(data);
|
2010-07-27 22:23:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ecore_x_selection_notify_send(xevent->xselectionrequest.requestor,
|
|
|
|
xevent->xselectionrequest.selection,
|
|
|
|
xevent->xselectionrequest.target,
|
|
|
|
property,
|
|
|
|
xevent->xselectionrequest.time);
|
|
|
|
}
|
2005-03-23 10:33:50 -08:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_selection_notify(XEvent *xevent)
|
|
|
|
{
|
2009-01-03 21:03:12 -08:00
|
|
|
Ecore_X_Event_Selection_Notify *e;
|
|
|
|
unsigned char *data = NULL;
|
|
|
|
Ecore_X_Atom selection;
|
|
|
|
int num_ret, format;
|
2004-01-10 13:01:18 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2004-01-10 13:01:18 -08:00
|
|
|
selection = xevent->xselection.selection;
|
|
|
|
|
2005-04-10 03:20:18 -07:00
|
|
|
if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS)
|
2005-03-23 10:33:50 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
|
|
|
|
xevent->xselection.property,
|
|
|
|
XA_ATOM, 32, &data, &num_ret);
|
|
|
|
if (!format)
|
2012-07-16 04:01:44 -07:00
|
|
|
{
|
|
|
|
/* fallback if targets handling is not working and try get the
|
|
|
|
* selection directly */
|
|
|
|
XConvertSelection(_ecore_x_disp, selection,
|
|
|
|
ECORE_X_ATOM_UTF8_STRING,
|
|
|
|
selection,
|
|
|
|
xevent->xselection.requestor,
|
|
|
|
CurrentTime);
|
2013-07-08 04:17:58 -07:00
|
|
|
if (data) free(data);
|
2012-07-16 04:01:44 -07:00
|
|
|
return;
|
|
|
|
}
|
2005-04-10 03:20:18 -07:00
|
|
|
}
|
|
|
|
else
|
2014-01-20 05:15:33 -08:00
|
|
|
{
|
|
|
|
format = ecore_x_window_prop_property_get(xevent->xselection.requestor,
|
|
|
|
xevent->xselection.property,
|
|
|
|
AnyPropertyType, 8, &data,
|
|
|
|
&num_ret);
|
|
|
|
if (!format) return;
|
|
|
|
}
|
2004-01-10 13:01:18 -08:00
|
|
|
|
2005-04-10 03:20:18 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2013-07-08 04:17:58 -07:00
|
|
|
{
|
|
|
|
if (data) free(data);
|
|
|
|
return;
|
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-04-10 03:20:18 -07:00
|
|
|
e->win = xevent->xselection.requestor;
|
|
|
|
e->time = xevent->xselection.time;
|
2009-03-22 11:19:17 -07:00
|
|
|
e->atom = selection;
|
2015-08-12 14:57:30 -07:00
|
|
|
e->property = xevent->xselection.property;
|
2005-04-10 03:20:18 -07:00
|
|
|
e->target = _ecore_x_selection_target_get(xevent->xselection.target);
|
2005-03-24 07:45:33 -08:00
|
|
|
|
|
|
|
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_PRIMARY;
|
2005-03-24 07:45:33 -08:00
|
|
|
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_SECONDARY;
|
2005-03-24 07:45:33 -08:00
|
|
|
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_XDND;
|
2005-03-24 07:45:33 -08:00
|
|
|
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_CLIPBOARD;
|
2005-03-24 07:45:33 -08:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_OTHER;
|
2009-03-22 11:19:17 -07:00
|
|
|
|
2006-09-28 22:49:14 -07:00
|
|
|
e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
|
2005-03-24 07:45:33 -08:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
|
2009-01-03 21:03:12 -08:00
|
|
|
_ecore_x_event_free_selection_notify, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_colormap_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Colormap *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2011-10-20 22:40:59 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
e->win = xevent->xcolormap.window;
|
|
|
|
e->cmap = xevent->xcolormap.colormap;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
|
|
|
if (xevent->xcolormap.state == ColormapInstalled)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->installed = EINA_TRUE;
|
2003-09-23 01:09:32 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->installed = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_client_message(XEvent *xevent)
|
|
|
|
{
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2003-09-23 01:09:32 -07:00
|
|
|
/* Special client message event handling here. need to put LOTS of if */
|
|
|
|
/* checks here and generate synthetic events per special message known */
|
|
|
|
/* otherwise generate generic client message event. this would handle*/
|
|
|
|
/* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */
|
2005-05-28 05:49:40 -07:00
|
|
|
if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
|
|
|
|
(xevent->xclient.format == 32) &&
|
|
|
|
(xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW))
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Window_Delete_Request *e;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->time = _ecore_x_event_last_time;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
|
|
|
|
}
|
2005-05-28 05:49:40 -07:00
|
|
|
else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
|
2010-07-27 22:23:42 -07:00
|
|
|
(xevent->xclient.format == 32) &&
|
|
|
|
/* Ignore move and resize with keyboard */
|
|
|
|
(xevent->xclient.data.l[2] < 9))
|
2005-05-28 05:49:40 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Window_Move_Resize_Request *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->x = xevent->xclient.data.l[0];
|
|
|
|
e->y = xevent->xclient.data.l[1];
|
|
|
|
e->direction = xevent->xclient.data.l[2];
|
|
|
|
e->button = xevent->xclient.data.l[3];
|
|
|
|
e->source = xevent->xclient.data.l[4];
|
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
|
2005-05-28 05:49:40 -07:00
|
|
|
}
|
2004-02-21 00:58:20 -08:00
|
|
|
/* Xdnd Client Message Handling Begin */
|
2005-03-24 07:45:33 -08:00
|
|
|
/* Message Type: XdndEnter target */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Enter *e;
|
|
|
|
Ecore_X_DND_Target *target;
|
2004-02-04 23:14:56 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
target = _ecore_x_dnd_target_get();
|
|
|
|
target->state = ECORE_X_DND_TARGET_ENTERED;
|
|
|
|
target->source = xevent->xclient.data.l[0];
|
|
|
|
target->win = xevent->xclient.window;
|
|
|
|
target->version = (int)(xevent->xclient.data.l[1] >> 24);
|
|
|
|
if (target->version > ECORE_X_DND_VERSION)
|
|
|
|
{
|
|
|
|
WRN("DND: Requested version %d, we only support up to %d",
|
|
|
|
target->version, ECORE_X_DND_VERSION);
|
2011-04-04 10:06:40 -07:00
|
|
|
free(e);
|
2010-07-27 22:23:42 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xevent->xclient.data.l[1] & 0x1UL)
|
|
|
|
{
|
|
|
|
/* source supports more than 3 types, fetch property */
|
2011-12-03 12:05:48 -08:00
|
|
|
unsigned char *data;
|
|
|
|
Ecore_X_Atom *types;
|
|
|
|
int i, num_ret;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
if (!(ecore_x_window_prop_property_get(target->source,
|
|
|
|
ECORE_X_ATOM_XDND_TYPE_LIST,
|
|
|
|
XA_ATOM,
|
|
|
|
32, &data, &num_ret)))
|
|
|
|
{
|
|
|
|
WRN(
|
|
|
|
"DND: Could not fetch data type list from source window, aborting.");
|
2013-07-08 04:24:21 -07:00
|
|
|
if (data) free(data);
|
2011-12-03 12:05:48 -08:00
|
|
|
free(e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
types = (Ecore_X_Atom *)data;
|
|
|
|
e->types = calloc(num_ret, sizeof(char *));
|
|
|
|
if (e->types)
|
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
for (i = 0; i < num_ret; i++)
|
|
|
|
e->types[i] = XGetAtomName(_ecore_x_disp, types[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
e->num_types = num_ret;
|
2013-07-08 06:22:20 -07:00
|
|
|
if (data) free(data);
|
2010-07-27 22:23:42 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
e->types = calloc(3, sizeof(char *));
|
|
|
|
if (e->types)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
while ((i < 3) && (xevent->xclient.data.l[i + 2]))
|
|
|
|
{
|
|
|
|
e->types[i] = XGetAtomName(_ecore_x_disp,
|
|
|
|
xevent->xclient.data.l[i + 2]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e->num_types = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
e->win = target->win;
|
|
|
|
e->source = target->source;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e,
|
2009-01-03 21:03:12 -08:00
|
|
|
_ecore_x_event_free_xdnd_enter, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2005-03-24 07:45:33 -08:00
|
|
|
/* Message Type: XdndPosition target */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Position *e;
|
|
|
|
Ecore_X_DND_Target *target;
|
2005-03-24 07:45:33 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
target = _ecore_x_dnd_target_get();
|
|
|
|
if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
|
|
|
|
(target->win != xevent->xclient.window))
|
2011-04-04 10:06:40 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
target->pos.x = xevent->xclient.data.l[2] >> 16;
|
|
|
|
target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL;
|
|
|
|
target->action = xevent->xclient.data.l[4]; /* Version 2 */
|
|
|
|
|
|
|
|
target->time = (target->version >= 1) ?
|
2011-04-04 10:06:40 -07:00
|
|
|
(Time)xevent->xclient.data.l[3] : CurrentTime;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = target->win;
|
|
|
|
e->source = target->source;
|
|
|
|
e->position.x = target->pos.x;
|
|
|
|
e->position.y = target->pos.y;
|
|
|
|
e->action = target->action;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2005-03-24 07:45:33 -08:00
|
|
|
/* Message Type: XdndStatus source */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Status *e;
|
|
|
|
Ecore_X_DND_Source *source;
|
2004-02-07 11:37:47 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
source = _ecore_x_dnd_source_get();
|
|
|
|
/* Make sure source/target match */
|
|
|
|
if ((source->win != xevent->xclient.window) ||
|
|
|
|
(source->dest != (Window)xevent->xclient.data.l[0]))
|
2011-04-04 10:06:40 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
source->await_status = 0;
|
|
|
|
|
|
|
|
source->will_accept = xevent->xclient.data.l[1] & 0x1UL;
|
|
|
|
source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1;
|
|
|
|
|
|
|
|
source->rectangle.x = xevent->xclient.data.l[2] >> 16;
|
|
|
|
source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL;
|
|
|
|
source->rectangle.width = xevent->xclient.data.l[3] >> 16;
|
|
|
|
source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL;
|
|
|
|
|
|
|
|
source->accepted_action = xevent->xclient.data.l[4];
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = source->win;
|
|
|
|
e->target = source->dest;
|
|
|
|
e->will_accept = source->will_accept;
|
|
|
|
e->rectangle.x = source->rectangle.x;
|
|
|
|
e->rectangle.y = source->rectangle.y;
|
|
|
|
e->rectangle.width = source->rectangle.width;
|
|
|
|
e->rectangle.height = source->rectangle.height;
|
|
|
|
e->action = source->accepted_action;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2005-03-24 07:45:33 -08:00
|
|
|
/* Message Type: XdndLeave target */
|
2004-02-21 00:58:20 -08:00
|
|
|
/* Pretend the whole thing never happened, sort of */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Leave *e;
|
|
|
|
Ecore_X_DND_Target *target;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
target = _ecore_x_dnd_target_get();
|
|
|
|
if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) ||
|
|
|
|
(target->win != xevent->xclient.window))
|
2011-04-04 10:06:40 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
target->state = ECORE_X_DND_TARGET_IDLE;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2005-03-24 07:45:33 -08:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->source = (Window)xevent->xclient.data.l[0];
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
|
|
|
|
}
|
2005-03-24 07:45:33 -08:00
|
|
|
/* Message Type: XdndDrop target */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Drop *e;
|
|
|
|
Ecore_X_DND_Target *target;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
target = _ecore_x_dnd_target_get();
|
|
|
|
/* Match source/target */
|
|
|
|
if ((target->source != (Window)xevent->xclient.data.l[0]) ||
|
|
|
|
(target->win != xevent->xclient.window))
|
2011-04-04 10:06:40 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
target->time = (target->version >= 1) ?
|
2011-10-20 22:40:59 -07:00
|
|
|
(Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = target->win;
|
|
|
|
e->source = target->source;
|
|
|
|
e->action = target->action;
|
|
|
|
e->position.x = target->pos.x;
|
|
|
|
e->position.y = target->pos.y;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
/* Message Type: XdndFinished source */
|
2004-12-04 02:10:29 -08:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED)
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Xdnd_Finished *e;
|
|
|
|
Ecore_X_DND_Source *source;
|
2010-10-27 17:32:43 -07:00
|
|
|
Eina_Bool completed = EINA_TRUE;
|
2005-03-23 02:53:34 -08:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2011-04-04 10:06:40 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
source = _ecore_x_dnd_source_get();
|
|
|
|
/* Match source/target */
|
|
|
|
if ((source->win != xevent->xclient.window) ||
|
|
|
|
(source->dest != (Window)xevent->xclient.data.l[0]))
|
2011-04-04 10:06:40 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL))
|
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
/* Target successfully performed drop action */
|
|
|
|
ecore_x_selection_xdnd_clear();
|
|
|
|
source->state = ECORE_X_DND_SOURCE_IDLE;
|
|
|
|
}
|
|
|
|
else if (source->version >= 5)
|
|
|
|
{
|
2010-10-27 17:32:43 -07:00
|
|
|
completed = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
source->state = ECORE_X_DND_SOURCE_CONVERTING;
|
|
|
|
|
|
|
|
/* FIXME: Probably need to add a timer to switch back to idle
|
|
|
|
* and discard the selection data */
|
|
|
|
}
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = source->win;
|
|
|
|
e->target = source->dest;
|
|
|
|
e->completed = completed;
|
|
|
|
if (source->version >= 5)
|
|
|
|
{
|
|
|
|
source->accepted_action = xevent->xclient.data.l[2];
|
|
|
|
e->action = source->accepted_action;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
source->accepted_action = 0;
|
|
|
|
e->action = source->action;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2005-04-28 05:26:34 -07:00
|
|
|
else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Window_State_Request *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
|
2011-04-04 10:06:40 -07:00
|
|
|
if (!e) return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
if (xevent->xclient.data.l[0] == 0)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xclient.data.l[0] == 1)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
|
2010-07-27 22:23:42 -07:00
|
|
|
else if (xevent->xclient.data.l[0] == 2)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
free(e);
|
|
|
|
return;
|
|
|
|
}
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]);
|
|
|
|
if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
|
2010-08-18 09:28:36 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
// char *name;
|
2011-12-03 12:05:48 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-28 10:35:31 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
|
|
|
|
// if (name) ERR("Unknown state: %s", name);
|
|
|
|
// XFree(name);
|
2010-08-18 09:28:36 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]);
|
|
|
|
if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
|
2010-08-18 09:28:36 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
// char *name;
|
2011-12-03 12:05:48 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-28 10:35:31 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
|
|
|
|
// if (name) ERR("Unknown state: %s", name);
|
|
|
|
// XFree(name);
|
2010-08-18 09:28:36 -07:00
|
|
|
}
|
2005-04-28 05:26:34 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->source = xevent->xclient.data.l[3];
|
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
|
2005-05-02 01:13:25 -07:00
|
|
|
}
|
|
|
|
else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE)
|
2010-07-27 22:23:42 -07:00
|
|
|
&& (xevent->xclient.format == 32)
|
|
|
|
&& (xevent->xclient.data.l[0] == IconicState))
|
2005-05-02 01:13:25 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Window_State_Request *e;
|
2005-05-02 01:13:25 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2005-05-02 01:13:25 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
|
|
|
|
e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
|
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
|
2005-04-28 05:26:34 -07:00
|
|
|
}
|
2005-05-16 08:42:50 -07:00
|
|
|
else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP)
|
2010-07-27 22:23:42 -07:00
|
|
|
&& (xevent->xclient.format == 32))
|
2005-05-16 08:42:50 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Desktop_Change *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2005-05-16 08:42:50 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->desk = xevent->xclient.data.l[0];
|
|
|
|
e->source = xevent->xclient.data.l[1];
|
2005-05-16 08:42:50 -07:00
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
|
2005-05-16 08:42:50 -07:00
|
|
|
}
|
2013-01-20 16:22:35 -08:00
|
|
|
else if (xevent->xclient.message_type ==
|
|
|
|
ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS)
|
2005-06-03 12:00:01 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Frame_Extents_Request *e;
|
2005-06-03 12:00:01 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2005-06-03 12:00:01 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
|
2005-06-03 12:00:01 -07:00
|
|
|
}
|
2005-06-05 07:46:55 -07:00
|
|
|
else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS)
|
2010-07-27 22:23:42 -07:00
|
|
|
&& ((Ecore_X_Atom)xevent->xclient.data.l[0] ==
|
|
|
|
ECORE_X_ATOM_NET_WM_PING)
|
|
|
|
&& (xevent->xclient.format == 32))
|
2005-06-05 07:46:55 -07:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Ping *e;
|
2010-02-23 20:36:22 -08:00
|
|
|
Ecore_X_Window root = 0;
|
2005-06-05 07:46:55 -07:00
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Ping));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->time = xevent->xclient.data.l[1];
|
|
|
|
e->event_win = xevent->xclient.data.l[2];
|
2005-06-05 07:46:55 -07:00
|
|
|
|
2010-01-29 02:28:54 -08:00
|
|
|
/* send a reply anyway - we are alive... eventloop at least */
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
|
2010-02-23 20:36:22 -08:00
|
|
|
if (ScreenCount(_ecore_x_disp) > 1)
|
2010-02-25 04:19:02 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
root = ecore_x_window_root_get(e->win);
|
|
|
|
}
|
2010-02-23 20:36:22 -08:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
root = DefaultRootWindow(_ecore_x_disp);
|
2010-02-23 20:36:22 -08:00
|
|
|
|
2010-01-29 02:28:54 -08:00
|
|
|
if (xevent->xclient.window != root)
|
|
|
|
{
|
|
|
|
xevent->xclient.window = root;
|
2010-07-27 22:23:42 -07:00
|
|
|
XSendEvent(_ecore_x_disp, root, False,
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
2010-01-29 02:28:54 -08:00
|
|
|
xevent);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2010-01-29 02:28:54 -08:00
|
|
|
}
|
2005-06-05 07:46:55 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
else if ((xevent->xclient.message_type ==
|
|
|
|
ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
|
|
|
|
(xevent->xclient.format == 8))
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_netwm_startup_info_begin(xevent->xclient.window,
|
|
|
|
xevent->xclient.data.b);
|
2005-09-29 23:16:49 -07:00
|
|
|
else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) &&
|
2010-07-27 22:23:42 -07:00
|
|
|
(xevent->xclient.format == 8))
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_netwm_startup_info(xevent->xclient.window,
|
|
|
|
xevent->xclient.data.b);
|
2005-07-12 08:27:46 -07:00
|
|
|
else if ((xevent->xclient.message_type == 27777)
|
2010-07-27 22:23:42 -07:00
|
|
|
&& (xevent->xclient.data.l[0] == 0x7162534)
|
|
|
|
&& (xevent->xclient.format == 32)
|
|
|
|
&& (xevent->xclient.window == _ecore_x_private_win))
|
2005-07-12 08:27:46 -07:00
|
|
|
{
|
2014-07-15 04:38:34 -07:00
|
|
|
int val = xevent->xclient.data.l[1] & 0xff;
|
|
|
|
int anymod = (xevent->xclient.data.l[1] >> 8) & 0xff;
|
|
|
|
int mod = xevent->xclient.data.l[4];
|
|
|
|
int b = xevent->xclient.data.l[3];
|
|
|
|
Ecore_X_Window swin = xevent->xclient.data.l[2];
|
|
|
|
|
2010-07-27 22:23:42 -07:00
|
|
|
/* a grab sync marker */
|
2014-07-15 04:38:34 -07:00
|
|
|
if (val == 1)
|
|
|
|
{
|
|
|
|
_ecore_x_window_grab_remove(swin, b, mod, anymod);
|
|
|
|
}
|
|
|
|
else if (val == 2)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
str = ecore_x_keysym_string_get(b);
|
|
|
|
if (str) _ecore_x_key_grab_remove(swin, str, mod, anymod);
|
|
|
|
}
|
2005-07-12 08:27:46 -07:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
else
|
2005-03-23 02:53:34 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Client_Message *e;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
e->win = xevent->xclient.window;
|
|
|
|
e->message_type = xevent->xclient.message_type;
|
|
|
|
e->format = xevent->xclient.format;
|
2015-07-21 15:08:16 -07:00
|
|
|
e->time = _ecore_x_event_last_time;
|
2010-07-27 22:23:42 -07:00
|
|
|
for (i = 0; i < 5; i++)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->data.l[i] = xevent->xclient.data.l[i];
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
|
2005-03-23 02:53:34 -08:00
|
|
|
}
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2009-03-13 08:55:34 -07:00
|
|
|
_ecore_x_event_handle_mapping_notify(XEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2010-10-27 17:32:43 -07:00
|
|
|
Ecore_X_Event_Mapping_Change *e;
|
2017-09-22 06:54:37 -07:00
|
|
|
static unsigned long last_serial;
|
|
|
|
int type;
|
2011-04-20 07:15:33 -07:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2014-07-04 02:02:10 -07:00
|
|
|
|
2010-10-27 17:32:43 -07:00
|
|
|
switch (xevent->xmapping.request)
|
2011-10-20 22:40:59 -07:00
|
|
|
{
|
2010-10-27 17:32:43 -07:00
|
|
|
case MappingModifier:
|
2017-09-22 06:54:37 -07:00
|
|
|
type = ECORE_X_MAPPING_MODIFIER;
|
2011-10-20 22:40:59 -07:00
|
|
|
break;
|
|
|
|
|
2010-10-27 17:32:43 -07:00
|
|
|
case MappingKeyboard:
|
2017-09-22 06:54:37 -07:00
|
|
|
if ((last_serial && (xevent->xmapping.serial == last_serial))) return;
|
|
|
|
type = ECORE_X_MAPPING_KEYBOARD;
|
|
|
|
last_serial = xevent->xmapping.serial;
|
2011-10-20 22:40:59 -07:00
|
|
|
break;
|
|
|
|
|
2010-10-27 17:32:43 -07:00
|
|
|
case MappingPointer:
|
|
|
|
default:
|
2017-09-22 06:54:37 -07:00
|
|
|
type = ECORE_X_MAPPING_MOUSE;
|
2011-10-20 22:40:59 -07:00
|
|
|
break;
|
|
|
|
}
|
2017-09-22 06:54:37 -07:00
|
|
|
|
|
|
|
_ecore_x_window_grab_suspend();
|
|
|
|
_ecore_x_key_grab_suspend();
|
|
|
|
|
|
|
|
XRefreshKeyboardMapping((XMappingEvent *)xevent);
|
|
|
|
_ecore_x_modifiers_get();
|
|
|
|
|
|
|
|
_ecore_x_window_grab_resume();
|
|
|
|
_ecore_x_key_grab_resume();
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change));
|
|
|
|
if (!e) return;
|
|
|
|
e->type = type;
|
2010-10-27 17:32:43 -07:00
|
|
|
e->keycode = xevent->xmapping.first_keycode;
|
|
|
|
e->num = xevent->xmapping.count;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void
|
2005-04-13 08:47:53 -07:00
|
|
|
_ecore_x_event_handle_shape_change(XEvent *xevent)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2005-04-13 08:47:53 -07:00
|
|
|
XShapeEvent *shape_event;
|
|
|
|
Ecore_X_Event_Window_Shape *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-04-13 08:47:53 -07:00
|
|
|
shape_event = (XShapeEvent *)xevent;
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-04-13 08:47:53 -07:00
|
|
|
e->win = shape_event->window;
|
|
|
|
e->time = shape_event->time;
|
2010-08-06 18:27:25 -07:00
|
|
|
switch (shape_event->kind)
|
|
|
|
{
|
2011-10-20 22:40:59 -07:00
|
|
|
case ShapeBounding:
|
2010-08-06 18:27:25 -07:00
|
|
|
e->type = ECORE_X_SHAPE_BOUNDING;
|
|
|
|
break;
|
2011-10-20 22:40:59 -07:00
|
|
|
|
|
|
|
case ShapeClip:
|
2010-08-06 18:27:25 -07:00
|
|
|
e->type = ECORE_X_SHAPE_CLIP;
|
|
|
|
break;
|
2011-10-20 22:40:59 -07:00
|
|
|
|
|
|
|
case ShapeInput:
|
2010-08-06 18:32:07 -07:00
|
|
|
e->type = ECORE_X_SHAPE_INPUT;
|
|
|
|
break;
|
2011-10-20 22:40:59 -07:00
|
|
|
|
|
|
|
default:
|
2010-08-06 18:27:25 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
e->x = shape_event->x;
|
|
|
|
e->y = shape_event->y;
|
|
|
|
e->w = shape_event->width;
|
|
|
|
e->h = shape_event->height;
|
|
|
|
e->shaped = shape_event->shaped;
|
2005-04-13 08:47:53 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2005-06-06 02:40:00 -07:00
|
|
|
|
2006-03-02 20:01:15 -08:00
|
|
|
void
|
|
|
|
_ecore_x_event_handle_screensaver_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
#ifdef ECORE_XSS
|
|
|
|
XScreenSaverNotifyEvent *screensaver_event;
|
|
|
|
Ecore_X_Event_Screensaver_Notify *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2006-03-02 20:01:15 -08:00
|
|
|
screensaver_event = (XScreenSaverNotifyEvent *)xevent;
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2006-03-02 20:01:15 -08:00
|
|
|
e->win = screensaver_event->window;
|
2012-08-26 08:34:40 -07:00
|
|
|
if ((screensaver_event->state == ScreenSaverOn) ||
|
|
|
|
(screensaver_event->state == ScreenSaverCycle))
|
2011-10-20 22:40:59 -07:00
|
|
|
e->on = EINA_TRUE;
|
2010-07-27 22:23:42 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->on = EINA_FALSE;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2006-03-02 20:01:15 -08:00
|
|
|
e->time = screensaver_event->time;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
|
2010-08-02 10:47:49 -07:00
|
|
|
#else /* ifdef ECORE_XSS */
|
2015-10-20 12:24:49 -07:00
|
|
|
(void) xevent;
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ECORE_XSS */
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2006-03-02 20:01:15 -08:00
|
|
|
|
2005-06-06 02:40:00 -07:00
|
|
|
void
|
|
|
|
_ecore_x_event_handle_sync_counter(XEvent *xevent)
|
|
|
|
{
|
|
|
|
XSyncCounterNotifyEvent *sync_counter_event;
|
|
|
|
Ecore_X_Event_Sync_Counter *e;
|
2009-01-03 21:03:12 -08:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-06-06 02:40:00 -07:00
|
|
|
sync_counter_event = (XSyncCounterNotifyEvent *)xevent;
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-06-06 02:40:00 -07:00
|
|
|
e->time = sync_counter_event->time;
|
|
|
|
ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2005-06-06 02:40:00 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_sync_alarm(XEvent *xevent)
|
|
|
|
{
|
|
|
|
XSyncAlarmNotifyEvent *sync_alarm_event;
|
|
|
|
Ecore_X_Event_Sync_Alarm *e;
|
2005-06-06 08:04:28 -07:00
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-06-06 02:40:00 -07:00
|
|
|
sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent;
|
2005-06-06 08:04:28 -07:00
|
|
|
|
2005-06-06 02:40:00 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-06-06 02:40:00 -07:00
|
|
|
e->time = sync_alarm_event->time;
|
2005-06-06 08:04:28 -07:00
|
|
|
e->alarm = sync_alarm_event->alarm;
|
2005-06-06 02:40:00 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2005-08-13 15:14:40 -07:00
|
|
|
|
|
|
|
#ifdef ECORE_XRANDR
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_randr_change(XEvent *xevent)
|
|
|
|
{
|
|
|
|
XRRScreenChangeNotifyEvent *randr_event;
|
|
|
|
Ecore_X_Event_Screen_Change *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2005-08-13 15:14:40 -07:00
|
|
|
randr_event = (XRRScreenChangeNotifyEvent *)xevent;
|
|
|
|
if (!XRRUpdateConfiguration(xevent))
|
2011-10-20 22:40:59 -07:00
|
|
|
ERR("Can't update RR config!");
|
2005-08-13 15:14:40 -07:00
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2005-08-13 15:14:40 -07:00
|
|
|
e->win = randr_event->window;
|
|
|
|
e->root = randr_event->root;
|
2010-08-14 03:21:03 -07:00
|
|
|
e->size.width = randr_event->width;
|
|
|
|
e->size.height = randr_event->height;
|
2009-05-02 16:34:29 -07:00
|
|
|
e->time = randr_event->timestamp;
|
|
|
|
e->config_time = randr_event->config_timestamp;
|
2010-08-14 03:21:03 -07:00
|
|
|
e->size.width_mm = randr_event->mwidth;
|
|
|
|
e->size.height_mm = randr_event->mheight;
|
|
|
|
e->orientation = randr_event->rotation;
|
2009-05-02 16:34:29 -07:00
|
|
|
e->subpixel_order = randr_event->subpixel_order;
|
2005-08-13 15:14:40 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-05-02 16:34:29 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent)
|
|
|
|
{
|
|
|
|
const XRRCrtcChangeNotifyEvent *randr_event;
|
|
|
|
Ecore_X_Event_Randr_Crtc_Change *e;
|
|
|
|
|
|
|
|
randr_event = (const XRRCrtcChangeNotifyEvent *)xevent;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
e->win = randr_event->window;
|
|
|
|
e->crtc = randr_event->crtc;
|
|
|
|
e->mode = randr_event->mode;
|
2010-08-14 03:21:03 -07:00
|
|
|
e->orientation = randr_event->rotation;
|
|
|
|
e->geo.x = randr_event->x;
|
|
|
|
e->geo.y = randr_event->y;
|
|
|
|
e->geo.w = randr_event->width;
|
|
|
|
e->geo.h = randr_event->height;
|
2009-05-02 16:34:29 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-05-02 16:34:29 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent)
|
|
|
|
{
|
|
|
|
const XRROutputChangeNotifyEvent *randr_event;
|
|
|
|
Ecore_X_Event_Randr_Output_Change *e;
|
|
|
|
|
|
|
|
randr_event = (const XRROutputChangeNotifyEvent *)xevent;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
e->win = randr_event->window;
|
|
|
|
e->output = randr_event->output;
|
|
|
|
e->crtc = randr_event->crtc;
|
|
|
|
e->mode = randr_event->mode;
|
2010-08-14 03:21:03 -07:00
|
|
|
e->orientation = randr_event->rotation;
|
2009-05-02 16:34:29 -07:00
|
|
|
e->connection = randr_event->connection;
|
|
|
|
e->subpixel_order = randr_event->subpixel_order;
|
2010-02-23 15:32:30 -08:00
|
|
|
ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-05-02 16:34:29 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent)
|
|
|
|
{
|
|
|
|
const XRROutputPropertyNotifyEvent *randr_event;
|
|
|
|
Ecore_X_Event_Randr_Output_Property_Notify *e;
|
|
|
|
|
|
|
|
randr_event = (const XRROutputPropertyNotifyEvent *)xevent;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
e->win = randr_event->window;
|
|
|
|
e->output = randr_event->output;
|
|
|
|
e->property = randr_event->property;
|
|
|
|
e->time = randr_event->timestamp;
|
2010-10-27 17:32:43 -07:00
|
|
|
if (randr_event->state == PropertyNewValue)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD;
|
2010-10-27 17:32:43 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL;
|
2010-02-23 15:32:30 -08:00
|
|
|
ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-05-02 16:34:29 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_randr_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
const XRRNotifyEvent *randr_event;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2009-05-02 16:34:29 -07:00
|
|
|
randr_event = (const XRRNotifyEvent *)xevent;
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2009-05-02 16:34:29 -07:00
|
|
|
switch (randr_event->subtype)
|
|
|
|
{
|
|
|
|
case RRNotify_CrtcChange:
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_event_handle_randr_notify_crtc_change(randr_event);
|
|
|
|
break;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
case RRNotify_OutputChange:
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_event_handle_randr_notify_output_change(randr_event);
|
|
|
|
break;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
case RRNotify_OutputProperty:
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_event_handle_randr_notify_output_property(randr_event);
|
|
|
|
break;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2009-05-02 16:34:29 -07:00
|
|
|
default:
|
2011-10-20 22:40:59 -07:00
|
|
|
ERR("Unknown XRandR RRNotify subtype: %d.",
|
|
|
|
randr_event->subtype);
|
|
|
|
break;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|
|
|
|
#endif /* ifdef ECORE_XRANDR */
|
2005-08-13 15:14:40 -07:00
|
|
|
|
2006-05-18 23:05:35 -07:00
|
|
|
#ifdef ECORE_XFIXES
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_fixes_selection_notify(XEvent *event)
|
|
|
|
{
|
2011-08-08 07:36:02 -07:00
|
|
|
XFixesSelectionNotifyEvent *notify_event =
|
2011-10-20 22:40:59 -07:00
|
|
|
(XFixesSelectionNotifyEvent *)event;
|
2011-08-08 07:36:02 -07:00
|
|
|
Ecore_X_Event_Fixes_Selection_Notify *e;
|
|
|
|
Ecore_X_Atom sel;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2006-05-18 23:05:35 -07:00
|
|
|
/* Nothing here yet */
|
2011-08-08 07:36:02 -07:00
|
|
|
|
|
|
|
e = calloc(1, sizeof(*e));
|
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2011-08-08 07:36:02 -07:00
|
|
|
|
|
|
|
e->win = notify_event->window;
|
|
|
|
e->owner = notify_event->owner;
|
|
|
|
e->time = notify_event->timestamp;
|
|
|
|
e->selection_time = notify_event->selection_timestamp;
|
|
|
|
e->atom = sel = notify_event->selection;
|
|
|
|
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_PRIMARY;
|
2011-08-08 07:36:02 -07:00
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_SECONDARY;
|
2014-01-09 22:46:15 -08:00
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_XDND)
|
|
|
|
e->selection = ECORE_X_SELECTION_XDND;
|
2011-08-08 07:36:02 -07:00
|
|
|
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_CLIPBOARD;
|
2011-08-08 07:36:02 -07:00
|
|
|
else
|
2011-10-20 22:40:59 -07:00
|
|
|
e->selection = ECORE_X_SELECTION_OTHER;
|
2011-08-08 07:36:02 -07:00
|
|
|
e->reason = notify_event->subtype;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|
|
|
|
#endif /* ifdef ECORE_XFIXES */
|
2006-05-18 23:05:35 -07:00
|
|
|
|
|
|
|
#ifdef ECORE_XDAMAGE
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_damage_notify(XEvent *event)
|
|
|
|
{
|
2012-08-18 04:29:47 -07:00
|
|
|
XDamageNotifyEvent *damage_event;
|
2006-05-18 23:05:35 -07:00
|
|
|
Ecore_X_Event_Damage *e;
|
|
|
|
|
2019-06-18 03:21:13 -07:00
|
|
|
_ecore_x_last_event_mouse_move = EINA_FALSE;
|
2006-05-19 07:23:04 -07:00
|
|
|
damage_event = (XDamageNotifyEvent *)event;
|
|
|
|
|
2006-05-18 23:05:35 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Damage));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2006-05-18 23:05:35 -07:00
|
|
|
|
|
|
|
e->level = damage_event->level;
|
|
|
|
e->drawable = damage_event->drawable;
|
|
|
|
e->damage = damage_event->damage;
|
|
|
|
e->more = damage_event->more;
|
|
|
|
e->time = damage_event->timestamp;
|
|
|
|
e->area.x = damage_event->area.x;
|
|
|
|
e->area.y = damage_event->area.y;
|
|
|
|
e->area.width = damage_event->area.width;
|
|
|
|
e->area.height = damage_event->area.height;
|
|
|
|
e->geometry.x = damage_event->geometry.x;
|
|
|
|
e->geometry.y = damage_event->geometry.y;
|
|
|
|
e->geometry.width = damage_event->geometry.width;
|
|
|
|
e->geometry.height = damage_event->geometry.height;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|
|
|
|
#endif /* ifdef ECORE_XDAMAGE */
|
2010-01-18 21:13:58 -08:00
|
|
|
|
|
|
|
static void
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_event_free_generic_event(void *data,
|
|
|
|
void *ev)
|
2010-01-18 21:13:58 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev;
|
|
|
|
|
2011-09-19 03:11:53 -07:00
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
if (e->data)
|
2011-10-20 22:40:59 -07:00
|
|
|
XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data);
|
2011-09-19 03:11:53 -07:00
|
|
|
free(data);
|
|
|
|
}
|
|
|
|
free(e);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-01-18 21:13:58 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_x_event_handle_generic_event(XEvent *event)
|
|
|
|
{
|
|
|
|
XGenericEvent *generic_event;
|
|
|
|
Ecore_X_Event_Generic *e;
|
2011-09-19 03:11:53 -07:00
|
|
|
XGenericEventCookie *data;
|
2011-10-20 22:40:59 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-01-18 21:13:58 -08:00
|
|
|
generic_event = (XGenericEvent *)event;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2014-01-09 23:26:06 -08:00
|
|
|
#ifdef ECORE_XPRESENT
|
|
|
|
if (generic_event->extension == _ecore_x_present_major)
|
|
|
|
{
|
|
|
|
_ecore_x_present_handler(generic_event);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Generic));
|
2010-07-27 22:23:42 -07:00
|
|
|
if (!e)
|
2011-10-20 22:40:59 -07:00
|
|
|
return;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2011-09-19 03:11:53 -07:00
|
|
|
if (XGetEventData(_ecore_x_disp, &(event->xcookie)))
|
2010-01-18 21:13:58 -08:00
|
|
|
{
|
|
|
|
e->cookie = event->xcookie.cookie;
|
|
|
|
e->data = event->xcookie.data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e->cookie = 0;
|
|
|
|
e->data = NULL;
|
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-01-18 21:13:58 -08:00
|
|
|
e->extension = generic_event->extension;
|
|
|
|
e->evtype = generic_event->evtype;
|
2014-01-09 23:26:06 -08:00
|
|
|
#ifdef ECORE_XI2
|
2010-01-18 21:13:58 -08:00
|
|
|
if (e->extension == _ecore_x_xi2_opcode)
|
2011-10-20 22:40:59 -07:00
|
|
|
_ecore_x_input_handler(event);
|
2014-01-09 23:26:06 -08:00
|
|
|
#endif /* ifdef ECORE_XI2 */
|
2011-09-19 03:11:53 -07:00
|
|
|
data = malloc(sizeof(XGenericEventCookie));
|
|
|
|
if (data) memcpy(data, &(event->xcookie), sizeof(XGenericEventCookie));
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_GENERIC,
|
|
|
|
e,
|
|
|
|
_ecore_x_event_free_generic_event,
|
2011-09-19 03:11:53 -07:00
|
|
|
data);
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|
2012-08-18 04:29:47 -07:00
|
|
|
#ifdef ECORE_XKB
|
2016-04-05 06:11:29 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
free_hash(void *userdata EINA_UNUSED, void *funcdata EINA_UNUSED)
|
|
|
|
{
|
|
|
|
eina_hash_del_by_data(emitted_events, (void*) 1);
|
|
|
|
}
|
|
|
|
|
2012-08-18 04:29:47 -07:00
|
|
|
void
|
|
|
|
_ecore_x_event_handle_xkb(XEvent *xevent)
|
|
|
|
{
|
|
|
|
XkbEvent *xkbev;
|
2016-04-05 06:11:29 -07:00
|
|
|
|
2012-08-18 04:29:47 -07:00
|
|
|
xkbev = (XkbEvent *) xevent;
|
2016-04-05 06:11:29 -07:00
|
|
|
|
|
|
|
|
2012-08-18 04:29:47 -07:00
|
|
|
if (xkbev->any.xkb_type == XkbStateNotify)
|
2016-04-05 06:11:29 -07:00
|
|
|
{
|
|
|
|
Ecore_X_Event_Xkb *e;
|
|
|
|
|
|
|
|
if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Ecore_X_Event_Xkb));
|
|
|
|
if (!e)
|
|
|
|
return;
|
|
|
|
|
|
|
|
e->group = xkbev->state.group;
|
2018-01-24 12:58:28 -08:00
|
|
|
e->base_group = xkbev->state.base_group;
|
|
|
|
e->latched_group = xkbev->state.latched_group;
|
|
|
|
e->locked_group = xkbev->state.locked_group;
|
|
|
|
|
|
|
|
e->mods = xkbev->state.mods;
|
|
|
|
e->base_mods = xkbev->state.base_mods;
|
|
|
|
e->latched_mods = xkbev->state.latched_mods;
|
|
|
|
e->locked_mods = xkbev->state.locked_mods;
|
2016-04-05 06:11:29 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e, free_hash, NULL);
|
|
|
|
eina_hash_add(emitted_events, &xkbev->state.serial, (void*) 1);
|
|
|
|
}
|
2012-08-18 20:06:46 -07:00
|
|
|
else if ((xkbev->any.xkb_type == XkbNewKeyboardNotify) ||
|
|
|
|
(xkbev->any.xkb_type == XkbMapNotify))
|
|
|
|
{
|
2016-04-05 06:11:29 -07:00
|
|
|
if (eina_hash_find(emitted_events, &xkbev->state.serial)) return;
|
|
|
|
|
2012-08-18 20:06:46 -07:00
|
|
|
if (xkbev->any.xkb_type == XkbMapNotify)
|
|
|
|
{
|
2020-05-19 10:41:29 -07:00
|
|
|
XkbMapNotifyEvent *xkbmapping = (XkbMapNotifyEvent *)xkbev;
|
2012-08-19 03:50:54 -07:00
|
|
|
|
2020-05-19 10:41:29 -07:00
|
|
|
_ecore_x_window_grab_suspend();
|
|
|
|
_ecore_x_key_grab_suspend();
|
|
|
|
XkbGetMap(_ecore_x_disp, XkbAllMapComponentsMask,
|
|
|
|
xkbmapping->device);
|
2012-08-18 20:06:46 -07:00
|
|
|
XkbRefreshKeyboardMapping(xkbmapping);
|
2020-05-19 10:41:29 -07:00
|
|
|
_ecore_x_modifiers_get();
|
|
|
|
_ecore_x_window_grab_resume();
|
|
|
|
_ecore_x_key_grab_resume();
|
2012-08-18 20:06:46 -07:00
|
|
|
}
|
2018-01-24 13:01:17 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
XkbNewKeyboardNotifyEvent *xkbnkn = (void*)xkbev;
|
|
|
|
if (!(xkbnkn->changed & XkbNKN_KeycodesMask)) return;
|
|
|
|
}
|
2016-04-05 06:11:29 -07:00
|
|
|
ecore_event_add(ECORE_X_EVENT_XKB_NEWKBD_NOTIFY, NULL, free_hash, NULL);
|
|
|
|
eina_hash_add(emitted_events, &xkbev->new_kbd.serial, (void*) 1);
|
2012-08-18 20:06:46 -07:00
|
|
|
}
|
2012-08-18 04:29:47 -07:00
|
|
|
}
|
|
|
|
#endif /* ifdef ECORE_XKB */
|