common: Make UNKNOWN a flag, not a combination of all directions

This was the original intention, but it was thought to be easier
to mark this as a combination of all directions. It turned out to
instead cause subtle bugs since code that blindly checked & DIR_WEST or
similar turned out to get it wrong when it was UNKNOWN, so just make
it an explicit flag.

This fixes the cursor appearing in the wrong place when starting a
keyboard resize.
This commit is contained in:
Jasper St. Pierre 2014-08-19 15:07:15 -04:00
parent 933d05a565
commit 711f0c0c50

View File

@ -126,25 +126,24 @@ typedef enum
* *
* If the directions field is 0000, then the operation is a move, * If the directions field is 0000, then the operation is a move,
* not a resize. * not a resize.
* If the directions field is 1111, then it's an unknown direction.
*/ */
enum enum
{ {
META_GRAB_OP_WINDOW_FLAG_KEYBOARD = 0x0100, META_GRAB_OP_WINDOW_FLAG_KEYBOARD = 0x0100,
META_GRAB_OP_WINDOW_FLAG_UNKNOWN = 0x0200,
META_GRAB_OP_WINDOW_DIR_WEST = 0x1000, META_GRAB_OP_WINDOW_DIR_WEST = 0x1000,
META_GRAB_OP_WINDOW_DIR_EAST = 0x2000, META_GRAB_OP_WINDOW_DIR_EAST = 0x2000,
META_GRAB_OP_WINDOW_DIR_SOUTH = 0x4000, META_GRAB_OP_WINDOW_DIR_SOUTH = 0x4000,
META_GRAB_OP_WINDOW_DIR_NORTH = 0x8000, META_GRAB_OP_WINDOW_DIR_NORTH = 0x8000,
META_GRAB_OP_WINDOW_DIR_UNKNOWN = 0xF000,
META_GRAB_OP_WINDOW_DIR_MASK = 0xF000, META_GRAB_OP_WINDOW_DIR_MASK = 0xF000,
/* WGO = "window grab op". shorthand for below */ /* WGO = "window grab op". shorthand for below */
_WGO_K = META_GRAB_OP_WINDOW_FLAG_KEYBOARD, _WGO_K = META_GRAB_OP_WINDOW_FLAG_KEYBOARD,
_WGO_U = META_GRAB_OP_WINDOW_FLAG_UNKNOWN,
_WGO_W = META_GRAB_OP_WINDOW_DIR_WEST, _WGO_W = META_GRAB_OP_WINDOW_DIR_WEST,
_WGO_E = META_GRAB_OP_WINDOW_DIR_EAST, _WGO_E = META_GRAB_OP_WINDOW_DIR_EAST,
_WGO_S = META_GRAB_OP_WINDOW_DIR_SOUTH, _WGO_S = META_GRAB_OP_WINDOW_DIR_SOUTH,
_WGO_N = META_GRAB_OP_WINDOW_DIR_NORTH, _WGO_N = META_GRAB_OP_WINDOW_DIR_NORTH,
_WGO_U = META_GRAB_OP_WINDOW_DIR_UNKNOWN,
}; };
#define GRAB_OP_GET_BASE_TYPE(op) (op & 0x00FF) #define GRAB_OP_GET_BASE_TYPE(op) (op & 0x00FF)
@ -172,7 +171,7 @@ typedef enum
META_GRAB_OP_RESIZING_SE = META_GRAB_OP_WINDOW_BASE | _WGO_S | _WGO_E, META_GRAB_OP_RESIZING_SE = META_GRAB_OP_WINDOW_BASE | _WGO_S | _WGO_E,
META_GRAB_OP_RESIZING_W = META_GRAB_OP_WINDOW_BASE | _WGO_W, META_GRAB_OP_RESIZING_W = META_GRAB_OP_WINDOW_BASE | _WGO_W,
META_GRAB_OP_KEYBOARD_MOVING = META_GRAB_OP_WINDOW_BASE | _WGO_K, META_GRAB_OP_KEYBOARD_MOVING = META_GRAB_OP_WINDOW_BASE | _WGO_K,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN = META_GRAB_OP_WINDOW_BASE | _WGO_U | _WGO_K, META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN = META_GRAB_OP_WINDOW_BASE | _WGO_K | _WGO_U,
META_GRAB_OP_KEYBOARD_RESIZING_NW = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_W | _WGO_K, META_GRAB_OP_KEYBOARD_RESIZING_NW = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_W | _WGO_K,
META_GRAB_OP_KEYBOARD_RESIZING_N = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_K, META_GRAB_OP_KEYBOARD_RESIZING_N = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_K,
META_GRAB_OP_KEYBOARD_RESIZING_NE = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_E | _WGO_K, META_GRAB_OP_KEYBOARD_RESIZING_NE = META_GRAB_OP_WINDOW_BASE | _WGO_N | _WGO_E | _WGO_K,