[mouse] Use different cursors for corners
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f00b5b252c
commit
6d89565c8e
|
@ -390,6 +390,10 @@ main(int argc, char **argv)
|
||||||
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[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[CurTopLeft] = create_font_cursor(CURSOR_TOP_LEFT_CORNER);
|
||||||
|
globalconf.cursor[CurBotRight] = create_font_cursor(CURSOR_BOTTOM_RIGHT_CORNER);
|
||||||
|
globalconf.cursor[CurBotLeft] = create_font_cursor(CURSOR_BOTTOM_LEFT_CORNER);
|
||||||
|
|
||||||
/* select for events */
|
/* select for events */
|
||||||
const uint32_t change_win_vals[] =
|
const uint32_t change_win_vals[] =
|
||||||
|
|
|
@ -37,6 +37,11 @@
|
||||||
#define CURSOR_FLEUR 52
|
#define CURSOR_FLEUR 52
|
||||||
#define CURSOR_LEFT_PTR 68
|
#define CURSOR_LEFT_PTR 68
|
||||||
#define CURSOR_SIZING 120
|
#define CURSOR_SIZING 120
|
||||||
|
#define CURSOR_BOTTOM_LEFT_CORNER 12
|
||||||
|
#define CURSOR_BOTTOM_RIGHT_CORNER 14
|
||||||
|
#define CURSOR_TOP_LEFT_CORNER 134
|
||||||
|
#define CURSOR_TOP_RIGHT_CORNER 136
|
||||||
|
|
||||||
|
|
||||||
#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 */
|
||||||
|
|
38
mouse.c
38
mouse.c
|
@ -217,10 +217,10 @@ mouse_query_pointer(xcb_window_t window, int *x, int *y)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Grab the Pointer
|
/** Grab the Pointer.
|
||||||
* \param window
|
* \param window The window grabbed.
|
||||||
* \param cursor the Cursor to display (see struct.h CurNormal, CurResize etc)
|
* \param cursor The cursor to display (see struct.h CurNormal, CurResize, etc).
|
||||||
* \return true on success, false if an error occured
|
* \return True on success, false if an error occured.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
mouse_grab_pointer(xcb_window_t window, size_t cursor)
|
mouse_grab_pointer(xcb_window_t window, size_t cursor)
|
||||||
|
@ -445,6 +445,7 @@ mouse_client_resize_floating(client_t *c)
|
||||||
/* the resize bar */
|
/* the resize bar */
|
||||||
simple_window_t *sw;
|
simple_window_t *sw;
|
||||||
draw_context_t *ctx;
|
draw_context_t *ctx;
|
||||||
|
size_t cursor = CurResize;
|
||||||
|
|
||||||
screen = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
|
screen = xcb_aux_get_screen(globalconf.connection, c->phys_screen);
|
||||||
|
|
||||||
|
@ -464,27 +465,40 @@ mouse_client_resize_floating(client_t *c)
|
||||||
{
|
{
|
||||||
mouse_y = top;
|
mouse_y = top;
|
||||||
fixed_y = bottom;
|
fixed_y = bottom;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mouse_y = bottom;
|
|
||||||
fixed_y = top;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(abs(left - mouse_x) < abs(right - mouse_x))
|
if(abs(left - mouse_x) < abs(right - mouse_x))
|
||||||
{
|
{
|
||||||
mouse_x = left;
|
mouse_x = left;
|
||||||
fixed_x = right;
|
fixed_x = right;
|
||||||
|
cursor = CurTopLeft;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mouse_x = right;
|
mouse_x = right;
|
||||||
fixed_x = left;
|
fixed_x = left;
|
||||||
|
cursor = CurTopRight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouse_y = bottom;
|
||||||
|
fixed_y = top;
|
||||||
|
if(abs(left - mouse_x) < abs(right - mouse_x))
|
||||||
|
{
|
||||||
|
mouse_x = left;
|
||||||
|
fixed_x = right;
|
||||||
|
cursor = CurBotLeft;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouse_x = right;
|
||||||
|
fixed_x = left;
|
||||||
|
cursor = CurBotRight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 corner */
|
/* set pointer to the moveable corner */
|
||||||
|
|
|
@ -45,7 +45,7 @@ typedef enum
|
||||||
|
|
||||||
/** Cursors */
|
/** Cursors */
|
||||||
enum
|
enum
|
||||||
{ CurNormal, CurResize, CurMove, CurLast };
|
{ CurNormal, CurResize, 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