Add a few more window hints

This commit is contained in:
Kevin Lange 2016-12-06 18:33:47 +09:00
parent de8d0f10a2
commit e61633453a
3 changed files with 11 additions and 4 deletions

View File

@ -248,12 +248,14 @@ int main(int argc, char * argv[]) {
init_decorations();
win_hints = yutani_window_create_flags(yctx, yctx->display_width, yctx->display_height, YUTANI_WINDOW_FLAG_NO_STEAL_FOCUS);
win_hints = yutani_window_create_flags(yctx, yctx->display_width, yctx->display_height,
YUTANI_WINDOW_FLAG_NO_STEAL_FOCUS | YUTANI_WINDOW_FLAG_DISALLOW_DRAG | YUTANI_WINDOW_FLAG_DISALLOW_RESIZE);
yutani_window_move(yctx, win_hints, 0, 0);
yutani_window_update_shape(yctx, win_hints, YUTANI_SHAPE_THRESHOLD_CLEAR);
ctx_hints = init_graphics_yutani_double_buffer(win_hints);
win_wizard = yutani_window_create(yctx, WIZARD_WIDTH, WIZARD_HEIGHT);
win_wizard = yutani_window_create_flags(yctx, WIZARD_WIDTH, WIZARD_HEIGHT,
YUTANI_WINDOW_FLAG_DISALLOW_DRAG | YUTANI_WINDOW_FLAG_DISALLOW_RESIZE);
yutani_window_move(yctx, win_wizard, center_x(WIZARD_WIDTH), center_y(WIZARD_HEIGHT));
ctx_wizard = init_graphics_yutani_double_buffer(win_wizard);

View File

@ -1698,7 +1698,8 @@ static void mouse_start_drag(yutani_globals_t * yg) {
set_focused_at(yg, yg->mouse_x / MOUSE_SCALE, yg->mouse_y / MOUSE_SCALE);
yg->mouse_window = get_focused(yg);
if (yg->mouse_window) {
if (yg->mouse_window->z == YUTANI_ZORDER_BOTTOM || yg->mouse_window->z == YUTANI_ZORDER_TOP) {
if (yg->mouse_window->z == YUTANI_ZORDER_BOTTOM || yg->mouse_window->z == YUTANI_ZORDER_TOP
|| yg->mouse_window->server_flags & YUTANI_WINDOW_FLAG_DISALLOW_DRAG) {
yg->mouse_state = YUTANI_MOUSE_STATE_NORMAL;
yg->mouse_window = NULL;
} else {
@ -1738,10 +1739,12 @@ static void mouse_start_resize(yutani_globals_t * yg, yutani_scale_direction_t d
set_focused_at(yg, yg->mouse_x / MOUSE_SCALE, yg->mouse_y / MOUSE_SCALE);
yg->mouse_window = get_focused(yg);
if (yg->mouse_window) {
if (yg->mouse_window->z == YUTANI_ZORDER_BOTTOM || yg->mouse_window->z == YUTANI_ZORDER_TOP) {
if (yg->mouse_window->z == YUTANI_ZORDER_BOTTOM || yg->mouse_window->z == YUTANI_ZORDER_TOP
|| yg->mouse_window->server_flags & YUTANI_WINDOW_FLAG_DISALLOW_RESIZE) {
/* Prevent resizing panel and wallpaper */
yg->mouse_state = YUTANI_MOUSE_STATE_NORMAL;
yg->mouse_window = NULL;
yg->resizing_window = NULL;
} else {
TRACE("resize starting for wid=%d", yg->mouse_window -> wid);
yg->mouse_state = YUTANI_MOUSE_STATE_RESIZING;

View File

@ -380,6 +380,8 @@ typedef struct yutani_window {
* should be created.
*/
#define YUTANI_WINDOW_FLAG_NO_STEAL_FOCUS (1 << 0)
#define YUTANI_WINDOW_FLAG_DISALLOW_DRAG (1 << 1)
#define YUTANI_WINDOW_FLAG_DISALLOW_RESIZE (1 << 2)
typedef struct {
int x;