grab pointer during cycling to remove focus screwups from focus-follows-mouse.
grab during move/resize and assign a cursor while doing the move/resize too!
This commit is contained in:
parent
962f0b3062
commit
372bf02947
1 changed files with 40 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "grab.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
|
@ -627,7 +628,7 @@ void action_toggle_decorations(union ActionData *data)
|
||||||
client_setup_decor_and_functions(c);
|
client_setup_decor_and_functions(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void popup_coords(char *format, int a, int b, gboolean hide)
|
static void popup_coords(char *format, Cursor cur, int a, int b, gboolean hide)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attrib;
|
XSetWindowAttributes attrib;
|
||||||
static Window coords = None;
|
static Window coords = None;
|
||||||
|
@ -638,11 +639,18 @@ static void popup_coords(char *format, int a, int b, gboolean hide)
|
||||||
0, 0, 1, 1, 0, render_depth, InputOutput,
|
0, 0, 1, 1, 0, render_depth, InputOutput,
|
||||||
render_visual, CWOverrideRedirect, &attrib);
|
render_visual, CWOverrideRedirect, &attrib);
|
||||||
g_assert(coords != None);
|
g_assert(coords != None);
|
||||||
|
|
||||||
|
grab_pointer(TRUE, cur);
|
||||||
|
|
||||||
|
XMapWindow(ob_display, coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide)
|
if (hide) {
|
||||||
XUnmapWindow(ob_display, coords);
|
XDestroyWindow(ob_display, coords);
|
||||||
else {
|
coords = None;
|
||||||
|
|
||||||
|
grab_pointer(FALSE, None);
|
||||||
|
} else {
|
||||||
Size s;
|
Size s;
|
||||||
char *text;
|
char *text;
|
||||||
|
|
||||||
|
@ -652,8 +660,6 @@ static void popup_coords(char *format, int a, int b, gboolean hide)
|
||||||
10, 10, s.width, s.height);
|
10, 10, s.width, s.height);
|
||||||
framerender_popup_label(coords, &s, text);
|
framerender_popup_label(coords, &s, text);
|
||||||
g_free(text);
|
g_free(text);
|
||||||
|
|
||||||
XMapWindow(ob_display, coords);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +673,7 @@ void action_move(union ActionData *data)
|
||||||
|
|
||||||
dispatch_move(c, &x, &y);
|
dispatch_move(c, &x, &y);
|
||||||
|
|
||||||
popup_coords("X: %d Y: %d", x, y, data->move.final);
|
popup_coords("X: %d Y: %d", ob_cursors.move, x, y, data->move.final);
|
||||||
|
|
||||||
frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */
|
frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */
|
||||||
client_configure(c, Corner_TopLeft, x, y, c->area.width, c->area.height,
|
client_configure(c, Corner_TopLeft, x, y, c->area.width, c->area.height,
|
||||||
|
@ -677,6 +683,7 @@ void action_move(union ActionData *data)
|
||||||
void action_resize(union ActionData *data)
|
void action_resize(union ActionData *data)
|
||||||
{
|
{
|
||||||
Client *c = data->resize.c;
|
Client *c = data->resize.c;
|
||||||
|
Cursor cur;
|
||||||
int w = data->resize.x;
|
int w = data->resize.x;
|
||||||
int h = data->resize.y;
|
int h = data->resize.y;
|
||||||
|
|
||||||
|
@ -690,7 +697,22 @@ void action_resize(union ActionData *data)
|
||||||
client_configure(c, data->resize.corner, c->area.x, c->area.y, w, h,
|
client_configure(c, data->resize.corner, c->area.x, c->area.y, w, h,
|
||||||
TRUE, data->resize.final);
|
TRUE, data->resize.final);
|
||||||
|
|
||||||
popup_coords("W: %d H: %d", c->logical_size.width,
|
switch (data->resize.corner) {
|
||||||
|
case Corner_TopLeft:
|
||||||
|
cur = ob_cursors.br;
|
||||||
|
break;
|
||||||
|
case Corner_TopRight:
|
||||||
|
cur = ob_cursors.bl;
|
||||||
|
break;
|
||||||
|
case Corner_BottomLeft:
|
||||||
|
cur = ob_cursors.tr;
|
||||||
|
break;
|
||||||
|
case Corner_BottomRight:
|
||||||
|
cur = ob_cursors.tl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup_coords("W: %d H: %d", cur, c->logical_size.width,
|
||||||
c->logical_size.height, data->move.final);
|
c->logical_size.height, data->move.final);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,11 +746,18 @@ static void popup_cycle(Client *c, gboolean hide)
|
||||||
0, 0, 1, 1, 0, render_depth, InputOutput,
|
0, 0, 1, 1, 0, render_depth, InputOutput,
|
||||||
render_visual, CWOverrideRedirect, &attrib);
|
render_visual, CWOverrideRedirect, &attrib);
|
||||||
g_assert(coords != None);
|
g_assert(coords != None);
|
||||||
|
|
||||||
|
grab_pointer(TRUE, None);
|
||||||
|
|
||||||
|
XMapWindow(ob_display, coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide)
|
if (hide) {
|
||||||
XUnmapWindow(ob_display, coords);
|
XDestroyWindow(ob_display, coords);
|
||||||
else {
|
coords = None;
|
||||||
|
|
||||||
|
grab_pointer(FALSE, None);
|
||||||
|
} else {
|
||||||
Rect *a;
|
Rect *a;
|
||||||
Size s;
|
Size s;
|
||||||
|
|
||||||
|
@ -740,8 +769,6 @@ static void popup_cycle(Client *c, gboolean hide)
|
||||||
a->y + (a->height - s.height) / 2,
|
a->y + (a->height - s.height) / 2,
|
||||||
s.width, s.height);
|
s.width, s.height);
|
||||||
framerender_popup_label(coords, &s, c->title);
|
framerender_popup_label(coords, &s, c->title);
|
||||||
|
|
||||||
XMapWindow(ob_display, coords);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue