mirror of
https://github.com/0intro/wmii
synced 2025-01-07 11:02:11 +03:00
removed border cursor displaying on motion event, we got Alt-Button{1,3}, we don't want redundant behavior
This commit is contained in:
parent
9708b26a9a
commit
d3fbdfac1b
@ -45,7 +45,7 @@ alloc_client(Window w, XWindowAttributes *wa)
|
|||||||
}
|
}
|
||||||
fwa.override_redirect = 1;
|
fwa.override_redirect = 1;
|
||||||
fwa.background_pixmap = ParentRelative;
|
fwa.background_pixmap = ParentRelative;
|
||||||
fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask | PointerMotionMask;
|
fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask;
|
||||||
|
|
||||||
c->framewin = XCreateWindow(dpy, root, c->rect.x, c->rect.y,
|
c->framewin = XCreateWindow(dpy, root, c->rect.x, c->rect.y,
|
||||||
c->rect.width + 2 * def.border, c->rect.height + def.border + bar_height(), 0,
|
c->rect.width + 2 * def.border, c->rect.height + def.border + bar_height(), 0,
|
||||||
|
@ -18,7 +18,6 @@ static void handle_expose(XEvent * e);
|
|||||||
static void handle_keypress(XEvent * e);
|
static void handle_keypress(XEvent * e);
|
||||||
static void handle_keymapnotify(XEvent * e);
|
static void handle_keymapnotify(XEvent * e);
|
||||||
static void handle_maprequest(XEvent * e);
|
static void handle_maprequest(XEvent * e);
|
||||||
static void handle_motionnotify(XEvent * e);
|
|
||||||
static void handle_propertynotify(XEvent * e);
|
static void handle_propertynotify(XEvent * e);
|
||||||
static void handle_unmapnotify(XEvent * e);
|
static void handle_unmapnotify(XEvent * e);
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ init_x_event_handler()
|
|||||||
handler[KeyPress] = handle_keypress;
|
handler[KeyPress] = handle_keypress;
|
||||||
handler[KeymapNotify] = handle_keymapnotify;
|
handler[KeymapNotify] = handle_keymapnotify;
|
||||||
handler[MapRequest] = handle_maprequest;
|
handler[MapRequest] = handle_maprequest;
|
||||||
handler[MotionNotify] = handle_motionnotify;
|
|
||||||
handler[PropertyNotify] = handle_propertynotify;
|
handler[PropertyNotify] = handle_propertynotify;
|
||||||
handler[UnmapNotify] = handle_unmapnotify;
|
handler[UnmapNotify] = handle_unmapnotify;
|
||||||
}
|
}
|
||||||
@ -72,15 +70,10 @@ handle_buttonpress(XEvent *e)
|
|||||||
}
|
}
|
||||||
else if((c = win2clientframe(ev->window))) {
|
else if((c = win2clientframe(ev->window))) {
|
||||||
if(ev->button == Button1) {
|
if(ev->button == Button1) {
|
||||||
Align align = xy2align(&c->rect, ev->x, ev->y);
|
|
||||||
if(sel_client() != c) {
|
if(sel_client() != c) {
|
||||||
focus(c);
|
focus(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(align == CENTER)
|
|
||||||
mouse_move(c);
|
|
||||||
else
|
|
||||||
mouse_resize(c, align);
|
|
||||||
}
|
}
|
||||||
if(c->nframe) {
|
if(c->nframe) {
|
||||||
snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button);
|
snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button);
|
||||||
@ -90,19 +83,20 @@ handle_buttonpress(XEvent *e)
|
|||||||
else if((c = win2client(ev->window))) {
|
else if((c = win2client(ev->window))) {
|
||||||
ev->state &= valid_mask;
|
ev->state &= valid_mask;
|
||||||
if(ev->state & Mod1Mask) {
|
if(ev->state & Mod1Mask) {
|
||||||
Align align = xy2align(&c->rect, ev->x, ev->y);
|
focus(c);
|
||||||
switch (ev->button) {
|
switch (ev->button) {
|
||||||
case Button1:
|
case Button1:
|
||||||
focus(c);
|
mouse_move(c);
|
||||||
mouse_move(c);
|
break;
|
||||||
break;
|
case Button3:
|
||||||
case Button3:
|
{
|
||||||
focus(c);
|
Align align = xy2align(&c->rect, ev->x, ev->y);
|
||||||
if(align == CENTER)
|
if(align == CENTER)
|
||||||
mouse_move(c);
|
mouse_move(c);
|
||||||
else
|
else
|
||||||
mouse_resize(c, align);
|
mouse_resize(c, align);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ev->button == Button1)
|
else if(ev->button == Button1)
|
||||||
@ -240,19 +234,6 @@ handle_maprequest(XEvent *e)
|
|||||||
manage_client(alloc_client(ev->window, &wa));
|
manage_client(alloc_client(ev->window, &wa));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_motionnotify(XEvent *e)
|
|
||||||
{
|
|
||||||
Client *c = win2clientframe(e->xmotion.window);
|
|
||||||
if(c) {
|
|
||||||
Cursor cur = cursor4motion(c, e->xmotion.x, e->xmotion.y);
|
|
||||||
if(cur == cursor[CurUnknown])
|
|
||||||
XUndefineCursor(dpy, c->framewin);
|
|
||||||
else
|
|
||||||
XDefineCursor(dpy, c->framewin, cur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_propertynotify(XEvent *e)
|
handle_propertynotify(XEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -9,48 +9,6 @@
|
|||||||
|
|
||||||
#include "wm.h"
|
#include "wm.h"
|
||||||
|
|
||||||
Cursor
|
|
||||||
cursor4motion(Client *c, int x, int y)
|
|
||||||
{
|
|
||||||
Frame *f = c->frame[c->sel];
|
|
||||||
int n, e, w, s, tn, te, tw, ts;
|
|
||||||
|
|
||||||
if(!def.border < 2)
|
|
||||||
return cursor[CurNormal];
|
|
||||||
|
|
||||||
/* rectangle attributes of client are used */
|
|
||||||
w = x < def.border - 1;
|
|
||||||
e = x >= f->rect.width - (def.border - 1);
|
|
||||||
n = y < def.border;
|
|
||||||
s = y >= f->rect.height - (def.border - 1);
|
|
||||||
|
|
||||||
tw = x < bar_height();
|
|
||||||
te = x > f->rect.width - bar_height();
|
|
||||||
tn = y < bar_height();
|
|
||||||
ts = s > f->rect.height - bar_height();
|
|
||||||
|
|
||||||
if((w && n) || (w && tn) || (n && tw))
|
|
||||||
return cursor[CurNW];
|
|
||||||
else if((e && n) || (e && tn) || (n && te))
|
|
||||||
return cursor[CurNE];
|
|
||||||
else if((w && s) || (w && ts) || (s && tw))
|
|
||||||
return cursor[CurSW];
|
|
||||||
else if((e && s) || (e && ts) || (s && te))
|
|
||||||
return cursor[CurSE];
|
|
||||||
else if(w)
|
|
||||||
return cursor[CurW];
|
|
||||||
else if(e)
|
|
||||||
return cursor[CurE];
|
|
||||||
else if(n)
|
|
||||||
return cursor[CurN];
|
|
||||||
else if(s)
|
|
||||||
return cursor[CurS];
|
|
||||||
|
|
||||||
if(tn)
|
|
||||||
return cursor[CurNormal];
|
|
||||||
return cursor[CurUnknown];
|
|
||||||
}
|
|
||||||
|
|
||||||
Align
|
Align
|
||||||
xy2align(XRectangle *rect, int x, int y)
|
xy2align(XRectangle *rect, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -139,18 +139,9 @@ init_atoms()
|
|||||||
static void
|
static void
|
||||||
init_cursors()
|
init_cursors()
|
||||||
{
|
{
|
||||||
cursor[CurUnknown] = XCreateFontCursor(dpy, XC_cross);
|
|
||||||
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
|
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
|
||||||
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
|
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
|
||||||
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
|
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
|
||||||
cursor[CurW] = XCreateFontCursor(dpy, XC_left_side);
|
|
||||||
cursor[CurE] = XCreateFontCursor(dpy, XC_right_side);
|
|
||||||
cursor[CurN] = XCreateFontCursor(dpy, XC_top_side);
|
|
||||||
cursor[CurS] = XCreateFontCursor(dpy, XC_bottom_side);
|
|
||||||
cursor[CurNW] = XCreateFontCursor(dpy, XC_top_left_corner);
|
|
||||||
cursor[CurNE] = XCreateFontCursor(dpy, XC_top_right_corner);
|
|
||||||
cursor[CurSW] = XCreateFontCursor(dpy, XC_bottom_left_corner);
|
|
||||||
cursor[CurSE] = XCreateFontCursor(dpy, XC_bottom_right_corner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
10
cmd/wm/wm.h
10
cmd/wm/wm.h
@ -27,18 +27,9 @@ enum {
|
|||||||
|
|
||||||
/* Cursor */
|
/* Cursor */
|
||||||
enum {
|
enum {
|
||||||
CurUnknown,
|
|
||||||
CurNormal,
|
CurNormal,
|
||||||
CurResize,
|
CurResize,
|
||||||
CurMove,
|
CurMove,
|
||||||
CurW,
|
|
||||||
CurE,
|
|
||||||
CurN,
|
|
||||||
CurS,
|
|
||||||
CurNW,
|
|
||||||
CurNE,
|
|
||||||
CurSW,
|
|
||||||
CurSE,
|
|
||||||
CurLast
|
CurLast
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -284,7 +275,6 @@ void init_lock_modifiers();
|
|||||||
/* mouse.c */
|
/* mouse.c */
|
||||||
void mouse_resize(Client *c, Align align);
|
void mouse_resize(Client *c, Align align);
|
||||||
void mouse_move(Client *c);
|
void mouse_move(Client *c);
|
||||||
Cursor cursor4motion(Client *c, int x, int y);
|
|
||||||
Align xy2align(XRectangle *rect, int x, int y);
|
Align xy2align(XRectangle *rect, int x, int y);
|
||||||
void drop_move(Client *c, XRectangle *new, XPoint *pt);
|
void drop_move(Client *c, XRectangle *new, XPoint *pt);
|
||||||
void grab_mouse(Window w, unsigned long mod, unsigned int button);
|
void grab_mouse(Window w, unsigned long mod, unsigned int button);
|
||||||
|
Loading…
Reference in New Issue
Block a user