[mouse] Use different cursors for vert./horiz. resize
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0db5446b2e
commit
8ab1831ed6
|
@ -389,6 +389,8 @@ main(int argc, char **argv)
|
||||||
/* init cursors */
|
/* init cursors */
|
||||||
globalconf.cursor[CurNormal] = create_font_cursor(CURSOR_LEFT_PTR);
|
globalconf.cursor[CurNormal] = create_font_cursor(CURSOR_LEFT_PTR);
|
||||||
globalconf.cursor[CurResize] = create_font_cursor(CURSOR_SIZING);
|
globalconf.cursor[CurResize] = create_font_cursor(CURSOR_SIZING);
|
||||||
|
globalconf.cursor[CurResizeH] = create_font_cursor(CURSOR_DOUBLE_ARROW_HORIZ);
|
||||||
|
globalconf.cursor[CurResizeV] = create_font_cursor(CURSOR_DOUBLE_ARROW_VERT);
|
||||||
globalconf.cursor[CurMove] = create_font_cursor(CURSOR_FLEUR);
|
globalconf.cursor[CurMove] = create_font_cursor(CURSOR_FLEUR);
|
||||||
globalconf.cursor[CurTopRight] = create_font_cursor(CURSOR_TOP_RIGHT_CORNER);
|
globalconf.cursor[CurTopRight] = create_font_cursor(CURSOR_TOP_RIGHT_CORNER);
|
||||||
globalconf.cursor[CurTopLeft] = create_font_cursor(CURSOR_TOP_LEFT_CORNER);
|
globalconf.cursor[CurTopLeft] = create_font_cursor(CURSOR_TOP_LEFT_CORNER);
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
#define CURSOR_BOTTOM_RIGHT_CORNER 14
|
#define CURSOR_BOTTOM_RIGHT_CORNER 14
|
||||||
#define CURSOR_TOP_LEFT_CORNER 134
|
#define CURSOR_TOP_LEFT_CORNER 134
|
||||||
#define CURSOR_TOP_RIGHT_CORNER 136
|
#define CURSOR_TOP_RIGHT_CORNER 136
|
||||||
|
#define CURSOR_DOUBLE_ARROW_HORIZ 108
|
||||||
|
#define CURSOR_DOUBLE_ARROW_VERT 116
|
||||||
|
|
||||||
#define ANY_KEY 0L /* special Key Code, passed to GrabKey */
|
#define ANY_KEY 0L /* special Key Code, passed to GrabKey */
|
||||||
#define ANY_MODIFIER (1<<15) /* used in Grabbutton_t, GrabKey */
|
#define ANY_MODIFIER (1<<15) /* used in Grabbutton_t, GrabKey */
|
||||||
|
|
15
mouse.c
15
mouse.c
|
@ -551,6 +551,7 @@ mouse_client_resize_tiled(client_t *c)
|
||||||
layout_t *layout;
|
layout_t *layout;
|
||||||
|
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
|
size_t cursor = CurResize;
|
||||||
|
|
||||||
screen = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
|
screen = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
|
||||||
tag = tags_get_current(c->screen)[0];
|
tag = tags_get_current(c->screen)[0];
|
||||||
|
@ -564,18 +565,30 @@ mouse_client_resize_tiled(client_t *c)
|
||||||
|
|
||||||
/* select initial pointer position */
|
/* select initial pointer position */
|
||||||
if(layout == layout_tile)
|
if(layout == layout_tile)
|
||||||
|
{
|
||||||
mouse_x = area.x + area.width * tag->mwfact;
|
mouse_x = area.x + area.width * tag->mwfact;
|
||||||
|
cursor = CurResizeH;
|
||||||
|
}
|
||||||
else if(layout == layout_tileleft)
|
else if(layout == layout_tileleft)
|
||||||
|
{
|
||||||
mouse_x = area.x + area.width * (1. - tag->mwfact);
|
mouse_x = area.x + area.width * (1. - tag->mwfact);
|
||||||
|
cursor = CurResizeH;
|
||||||
|
}
|
||||||
else if(layout == layout_tilebottom)
|
else if(layout == layout_tilebottom)
|
||||||
|
{
|
||||||
mouse_y = area.y + area.height * tag->mwfact;
|
mouse_y = area.y + area.height * tag->mwfact;
|
||||||
|
cursor = CurResizeV;
|
||||||
|
}
|
||||||
else if(layout == layout_tiletop)
|
else if(layout == layout_tiletop)
|
||||||
|
{
|
||||||
mouse_y = area.y + area.height * (1. - tag->mwfact);
|
mouse_y = area.y + area.height * (1. - tag->mwfact);
|
||||||
|
cursor = CurResizeV;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* grab the pointer */
|
/* grab the pointer */
|
||||||
if(!mouse_grab_pointer(screen->root, CurResize))
|
if(!mouse_grab_pointer(screen->root, cursor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* set pointer to the moveable border */
|
/* set pointer to the moveable border */
|
||||||
|
|
|
@ -45,7 +45,10 @@ typedef enum
|
||||||
|
|
||||||
/** Cursors */
|
/** Cursors */
|
||||||
enum
|
enum
|
||||||
{ CurNormal, CurResize, CurMove, CurTopLeft, CurTopRight, CurBotLeft, CurBotRight, CurLast };
|
{
|
||||||
|
CurNormal, CurResize, CurResizeH, CurResizeV, CurMove,
|
||||||
|
CurTopLeft, CurTopRight, CurBotLeft, CurBotRight, CurLast
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct button_t button_t;
|
typedef struct button_t button_t;
|
||||||
typedef struct widget_t widget_t;
|
typedef struct widget_t widget_t;
|
||||||
|
|
Loading…
Reference in New Issue