no more interactive mouse actions, they are evil etc. actions now "feel" much more solid. if move/resizing a window while changing workspaces, it will follow.
This commit is contained in:
parent
0f544808b8
commit
8fe0cb8989
8 changed files with 28 additions and 32 deletions
|
@ -767,7 +767,6 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_run_full(ObAction *a, struct _ObClient *c,
|
void action_run_full(ObAction *a, struct _ObClient *c,
|
||||||
ObFrameContext context,
|
|
||||||
guint state, guint button, gint x, gint y,
|
guint state, guint button, gint x, gint y,
|
||||||
gboolean cancel, gboolean done)
|
gboolean cancel, gboolean done)
|
||||||
{
|
{
|
||||||
|
@ -784,7 +783,7 @@ void action_run_full(ObAction *a, struct _ObClient *c,
|
||||||
a->data.inter.cancel = cancel;
|
a->data.inter.cancel = cancel;
|
||||||
a->data.inter.final = done;
|
a->data.inter.final = done;
|
||||||
if (!(cancel || done))
|
if (!(cancel || done))
|
||||||
keyboard_interactive_grab(state, c, context, a);
|
keyboard_interactive_grab(state, c, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
a->func(&a->data);
|
a->func(&a->data);
|
||||||
|
|
|
@ -153,7 +153,6 @@ void action_free(ObAction *a);
|
||||||
|
|
||||||
/*! Executes an action.
|
/*! Executes an action.
|
||||||
@param c The client associated with the action. Can be NULL.
|
@param c The client associated with the action. Can be NULL.
|
||||||
@param context The context in which the user action occured.
|
|
||||||
@param state The keyboard modifiers state at the time the user action occured
|
@param state The keyboard modifiers state at the time the user action occured
|
||||||
@param button The mouse button used to execute the action.
|
@param button The mouse button used to execute the action.
|
||||||
@param x The x coord at which the user action occured.
|
@param x The x coord at which the user action occured.
|
||||||
|
@ -164,21 +163,20 @@ void action_free(ObAction *a);
|
||||||
affects interactive actions, but should generally always be FALSE.
|
affects interactive actions, but should generally always be FALSE.
|
||||||
*/
|
*/
|
||||||
void action_run_full(ObAction *a, struct _ObClient *c,
|
void action_run_full(ObAction *a, struct _ObClient *c,
|
||||||
ObFrameContext context,
|
|
||||||
guint state, guint button, gint x, gint y,
|
guint state, guint button, gint x, gint y,
|
||||||
gboolean cancel, gboolean done);
|
gboolean cancel, gboolean done);
|
||||||
|
|
||||||
#define action_run_mouse(a, c, t, s, b, x, y) \
|
#define action_run_mouse(a, c, s, b, x, y) \
|
||||||
action_run_full(a, c, t, s, b, x, y, FALSE, FALSE)
|
action_run_full(a, c, s, b, x, y, FALSE, FALSE)
|
||||||
|
|
||||||
#define action_run_interactive(a, c, s, n, d) \
|
#define action_run_interactive(a, c, s, n, d) \
|
||||||
action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, n, d)
|
action_run_full(a, c, s, 0, -1, -1, n, d)
|
||||||
|
|
||||||
#define action_run_key(a, c, s, x, y) \
|
#define action_run_key(a, c, s, x, y) \
|
||||||
action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE,FALSE)
|
action_run_full(a, c, s, 0, x, y, FALSE,FALSE)
|
||||||
|
|
||||||
#define action_run(a, c, s) \
|
#define action_run(a, c, s) \
|
||||||
action_run_full(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE,FALSE)
|
action_run_full(a, c, s, 0, -1, -1, FALSE,FALSE)
|
||||||
|
|
||||||
/* Execute */
|
/* Execute */
|
||||||
void action_execute(union ActionData *data);
|
void action_execute(union ActionData *data);
|
||||||
|
|
|
@ -487,17 +487,14 @@ static void event_process(const XEvent *ec, gpointer data)
|
||||||
{
|
{
|
||||||
if (menu_frame_visible)
|
if (menu_frame_visible)
|
||||||
event_handle_menu(e);
|
event_handle_menu(e);
|
||||||
else if (moveresize_in_progress)
|
|
||||||
moveresize_event(e);
|
|
||||||
else {
|
else {
|
||||||
ObFrameContext context;
|
if (!keyboard_process_interactive_grab(e)) {
|
||||||
|
if (moveresize_in_progress)
|
||||||
|
moveresize_event(e);
|
||||||
|
|
||||||
context = frame_context(client, e->xany.window);
|
|
||||||
|
|
||||||
if (!keyboard_process_interactive_grab(e, &client, &context)) {
|
|
||||||
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
||||||
e->type == MotionNotify)
|
e->type == MotionNotify)
|
||||||
mouse_event(client, context, e);
|
mouse_event(client, e);
|
||||||
else if (e->type == KeyPress)
|
else if (e->type == KeyPress)
|
||||||
/* when in the middle of a focus cycling action, this
|
/* when in the middle of a focus cycling action, this
|
||||||
causes the window which appears to be focused to be
|
causes the window which appears to be focused to be
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "keytree.h"
|
#include "keytree.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "translate.h"
|
#include "translate.h"
|
||||||
|
#include "moveresize.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -129,12 +130,15 @@ gboolean keyboard_bind(GList *keylist, ObAction *action)
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard_interactive_grab(guint state, ObClient *client,
|
void keyboard_interactive_grab(guint state, ObClient *client,
|
||||||
ObFrameContext context, ObAction *action)
|
ObAction *action)
|
||||||
{
|
{
|
||||||
ObInteractiveState *s;
|
ObInteractiveState *s;
|
||||||
|
|
||||||
g_assert(action->data.any.interactive);
|
g_assert(action->data.any.interactive);
|
||||||
|
|
||||||
|
if (moveresize_in_progress)
|
||||||
|
moveresize_end(FALSE);
|
||||||
|
|
||||||
if (!interactive_states) {
|
if (!interactive_states) {
|
||||||
if (!grab_keyboard(TRUE))
|
if (!grab_keyboard(TRUE))
|
||||||
return;
|
return;
|
||||||
|
@ -149,14 +153,11 @@ void keyboard_interactive_grab(guint state, ObClient *client,
|
||||||
s->state = state;
|
s->state = state;
|
||||||
s->client = client;
|
s->client = client;
|
||||||
s->action = action;
|
s->action = action;
|
||||||
s->context = context;
|
|
||||||
|
|
||||||
interactive_states = g_slist_append(interactive_states, s);
|
interactive_states = g_slist_append(interactive_states, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean keyboard_process_interactive_grab(const XEvent *e,
|
gboolean keyboard_process_interactive_grab(const XEvent *e)
|
||||||
ObClient **client,
|
|
||||||
ObFrameContext *context)
|
|
||||||
{
|
{
|
||||||
GSList *it, *next;
|
GSList *it, *next;
|
||||||
gboolean handled = FALSE;
|
gboolean handled = FALSE;
|
||||||
|
@ -168,9 +169,6 @@ gboolean keyboard_process_interactive_grab(const XEvent *e,
|
||||||
|
|
||||||
next = g_slist_next(it);
|
next = g_slist_next(it);
|
||||||
|
|
||||||
*client = s->client;
|
|
||||||
*context = s->context;
|
|
||||||
|
|
||||||
if ((e->type == KeyRelease &&
|
if ((e->type == KeyRelease &&
|
||||||
!(s->state & e->xkey.state)))
|
!(s->state & e->xkey.state)))
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
|
|
|
@ -21,11 +21,8 @@ void keyboard_event(struct _ObClient *client, const XEvent *e);
|
||||||
void keyboard_reset_chains();
|
void keyboard_reset_chains();
|
||||||
|
|
||||||
void keyboard_interactive_grab(guint state, struct _ObClient *client,
|
void keyboard_interactive_grab(guint state, struct _ObClient *client,
|
||||||
ObFrameContext context,
|
|
||||||
struct _ObAction *action);
|
struct _ObAction *action);
|
||||||
gboolean keyboard_process_interactive_grab(const XEvent *e,
|
gboolean keyboard_process_interactive_grab(const XEvent *e);
|
||||||
struct _ObClient **client,
|
|
||||||
ObFrameContext *context);
|
|
||||||
|
|
||||||
void keyboard_grab_for_client(struct _ObClient *c, gboolean grab);
|
void keyboard_grab_for_client(struct _ObClient *c, gboolean grab);
|
||||||
|
|
||||||
|
|
|
@ -107,20 +107,23 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
|
||||||
if (it == NULL) return FALSE;
|
if (it == NULL) return FALSE;
|
||||||
|
|
||||||
for (it = b->actions[a]; it; it = it->next)
|
for (it = b->actions[a]; it; it = it->next)
|
||||||
action_run_mouse(it->data, c, context, state, button, x, y);
|
action_run_mouse(it->data, c, state, button, x, y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouse_event(ObClient *client, ObFrameContext context, XEvent *e)
|
void mouse_event(ObClient *client, XEvent *e)
|
||||||
{
|
{
|
||||||
static Time ltime;
|
static Time ltime;
|
||||||
static guint button = 0, state = 0, lbutton = 0;
|
static guint button = 0, state = 0, lbutton = 0;
|
||||||
|
|
||||||
static Window lwindow = None;
|
static Window lwindow = None;
|
||||||
static int px, py;
|
static int px, py;
|
||||||
|
|
||||||
|
ObFrameContext context;
|
||||||
gboolean click = FALSE;
|
gboolean click = FALSE;
|
||||||
gboolean dclick = FALSE;
|
gboolean dclick = FALSE;
|
||||||
|
|
||||||
|
context = frame_context(client, e->xany.window);
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
px = e->xbutton.x_root;
|
px = e->xbutton.x_root;
|
||||||
|
|
|
@ -13,7 +13,7 @@ void mouse_shutdown(gboolean reconfig);
|
||||||
gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact,
|
gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact,
|
||||||
ObAction *action);
|
ObAction *action);
|
||||||
|
|
||||||
void mouse_event(struct _ObClient *client, ObFrameContext context, XEvent *e);
|
void mouse_event(struct _ObClient *client, XEvent *e);
|
||||||
|
|
||||||
void mouse_grab_for_client(struct _ObClient *client, gboolean grab);
|
void mouse_grab_for_client(struct _ObClient *client, gboolean grab);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "grab.h"
|
#include "grab.h"
|
||||||
#include "startupnotify.h"
|
#include "startupnotify.h"
|
||||||
|
#include "moveresize.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
@ -410,6 +411,9 @@ void screen_set_desktop(guint num)
|
||||||
|
|
||||||
ob_debug("Moving to desktop %d\n", num+1);
|
ob_debug("Moving to desktop %d\n", num+1);
|
||||||
|
|
||||||
|
if (moveresize_client)
|
||||||
|
client_set_desktop(moveresize_client, num, TRUE);
|
||||||
|
|
||||||
/* show windows before hiding the rest to lessen the enter/leave events */
|
/* show windows before hiding the rest to lessen the enter/leave events */
|
||||||
|
|
||||||
/* show windows from top to bottom */
|
/* show windows from top to bottom */
|
||||||
|
|
Loading…
Reference in a new issue