forked from enlightenment/efl
yay! new api calls :) (auto replay of button pre3sses due to button grabs
now...) SVN revision: 5495
This commit is contained in:
parent
9f4404a2ec
commit
fd9bd68617
|
@ -38,6 +38,8 @@
|
|||
#define XEV_PROPERTY PropertyChangeMask
|
||||
#define XEV_COLORMAP ColormapChangeMask
|
||||
|
||||
extern XContext xid_context;
|
||||
|
||||
typedef struct _e_xid E_XID;
|
||||
typedef struct _e_keygrab E_KeyGrab;
|
||||
|
||||
|
@ -66,6 +68,10 @@ struct _e_xid
|
|||
int gravity;
|
||||
int coords_invalid;
|
||||
int bw;
|
||||
int grab_button_auto_replay;
|
||||
int grab_button_button;
|
||||
Ev_Key_Modifiers grab_button_mods;
|
||||
int grab_button_any_mod;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -301,6 +307,9 @@ void e_set_blank_pointer(Window w);
|
|||
Cursor e_cursor_new(Pixmap pmap, Pixmap mask, int x, int y, int fr, int fg, int fb, int br, int bg, int bb);
|
||||
void e_cursor_free(Cursor c);
|
||||
void e_cursor_set(Window win, Cursor c);
|
||||
|
||||
void e_window_button_grab_auto_replay_set(Window win, int on);
|
||||
int e_window_button_grab_auto_replay_get(Window win);
|
||||
|
||||
typedef struct _eev Eevent;
|
||||
typedef struct _ev_fd_handler Ev_Fd_Handler;
|
||||
|
|
|
@ -406,6 +406,26 @@ e_ev_x_handle_button_press(XEvent * xevent)
|
|||
e->double_click = 1;
|
||||
}
|
||||
e_add_event(EV_MOUSE_DOWN, e, e_ev_generic_free);
|
||||
{
|
||||
E_XID *xid = NULL;
|
||||
|
||||
if (XFindContext(xevent->xbutton.display, e->win,
|
||||
xid_context, (XPointer *) & xid) != XCNOENT)
|
||||
{
|
||||
if (xid->grab_button_auto_replay)
|
||||
{
|
||||
if ((xid->grab_button_button == 0) ||
|
||||
(xid->grab_button_button == e->button))
|
||||
{
|
||||
if ((xid->grab_button_any_mod) ||
|
||||
(xid->grab_button_mods == e->mods))
|
||||
{
|
||||
e_pointer_replay(e->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
last_last_window = last_window;
|
||||
last_window = xevent->xbutton.window;
|
||||
|
|
|
@ -20,6 +20,8 @@ struct _window_list
|
|||
Window_List *next;
|
||||
};
|
||||
|
||||
XContext xid_context = 0;
|
||||
|
||||
static Display *disp;
|
||||
static Visual *default_vis;
|
||||
static Colormap default_cm;
|
||||
|
@ -27,8 +29,6 @@ static int default_depth;
|
|||
static Window default_win;
|
||||
static Window default_root;
|
||||
|
||||
static XContext xid_context = 0;
|
||||
|
||||
static int lock_scroll = 0;
|
||||
static int lock_num = 0;
|
||||
static int lock_caps = 0;
|
||||
|
@ -210,6 +210,10 @@ e_add_xid(Window win, int x, int y, int w, int h, int depth, Window parent)
|
|||
xid->children = NULL;
|
||||
xid->gravity = e_window_get_gravity(win);
|
||||
xid->bw = 0;
|
||||
xid->grab_button_auto_replay = 0;
|
||||
xid->grab_button_button = 0;
|
||||
xid->grab_button_mods = EV_KEY_MODIFIER_NONE;
|
||||
xid->grab_button_any_mod = 0;
|
||||
XSaveContext(disp, xid->win, xid_context, (XPointer) xid);
|
||||
e_add_child(parent, win);
|
||||
return xid;
|
||||
|
@ -269,6 +273,10 @@ e_validate_xid(Window win)
|
|||
xid->mouse_in = 0;
|
||||
xid->gravity = att.win_gravity;
|
||||
xid->bw = att.border_width;
|
||||
xid->grab_button_auto_replay = 0;
|
||||
xid->grab_button_button = 0;
|
||||
xid->grab_button_mods = EV_KEY_MODIFIER_NONE;
|
||||
xid->grab_button_any_mod = 0;
|
||||
XSaveContext(disp, xid->win, xid_context, (XPointer) xid);
|
||||
e_add_child(xid->parent, win);
|
||||
}
|
||||
|
@ -2778,6 +2786,26 @@ e_window_get_root_relative_location(Window win, int *x, int *y)
|
|||
if (y) *y = dy;
|
||||
}
|
||||
|
||||
void
|
||||
e_window_button_grab_auto_replay_set(Window win, int on)
|
||||
{
|
||||
E_XID *xid = NULL;
|
||||
|
||||
xid = e_validate_xid(win);
|
||||
if (!xid) return;
|
||||
xid->grab_button_auto_replay = on;
|
||||
}
|
||||
|
||||
int
|
||||
e_window_button_grab_auto_replay_get(Window win)
|
||||
{
|
||||
E_XID *xid = NULL;
|
||||
|
||||
xid = e_validate_xid(win);
|
||||
if (!xid) return 0;
|
||||
return xid->grab_button_auto_replay;
|
||||
}
|
||||
|
||||
void
|
||||
e_button_grab(Window win, int button, int events, Ev_Key_Modifiers mod, int any_mod)
|
||||
{
|
||||
|
@ -2785,7 +2813,10 @@ e_button_grab(Window win, int button, int events, Ev_Key_Modifiers mod, int any_
|
|||
unsigned int m;
|
||||
unsigned int locks[8];
|
||||
int i;
|
||||
E_XID *xid = NULL;
|
||||
|
||||
xid = e_validate_xid(win);
|
||||
if (!xid) return;
|
||||
b = button;
|
||||
if (b == 0) b = AnyButton;
|
||||
m = 0;
|
||||
|
@ -2805,6 +2836,9 @@ e_button_grab(Window win, int button, int events, Ev_Key_Modifiers mod, int any_
|
|||
locks[5] = e_lock_mask_caps_get() | e_lock_mask_scroll_get();
|
||||
locks[6] = e_lock_mask_num_get() | e_lock_mask_scroll_get();
|
||||
locks[7] = e_lock_mask_caps_get() | e_lock_mask_num_get() | e_lock_mask_scroll_get();
|
||||
xid->grab_button_button = button;
|
||||
xid->grab_button_any_mod = any_mod;
|
||||
xid->grab_button_mods = m;
|
||||
for (i = 0; i < 8; i++)
|
||||
XGrabButton(disp, b, m | locks[i],
|
||||
win, False, events,
|
||||
|
@ -2818,7 +2852,11 @@ e_button_ungrab(Window win, int button, Ev_Key_Modifiers mod, int any_mod)
|
|||
unsigned int m;
|
||||
unsigned int locks[8];
|
||||
int i;
|
||||
E_XID *xid = NULL;
|
||||
|
||||
xid = e_validate_xid(win);
|
||||
if (!xid) return;
|
||||
xid->grab_button_auto_replay = 0;
|
||||
b = button;
|
||||
if (b == 0) b = AnyButton;
|
||||
m = 0;
|
||||
|
|
Loading…
Reference in New Issue