|
|
@ -56,20 +56,13 @@ fullscreen_handler(struct window *window, void *data); |
|
|
|
static void |
|
|
|
static void |
|
|
|
redraw_handler(struct widget *widget, void *data); |
|
|
|
redraw_handler(struct widget *widget, void *data); |
|
|
|
|
|
|
|
|
|
|
|
/* Iff parent_window is set, the new window will be transient. */ |
|
|
|
|
|
|
|
static struct window * |
|
|
|
static struct window * |
|
|
|
new_window(struct stacking *stacking, struct window *parent_window) |
|
|
|
new_window(struct stacking *stacking) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct window *new_window; |
|
|
|
struct window *new_window; |
|
|
|
struct widget *new_widget; |
|
|
|
struct widget *new_widget; |
|
|
|
|
|
|
|
|
|
|
|
if (parent_window == NULL) { |
|
|
|
|
|
|
|
new_window = window_create(stacking->display); |
|
|
|
new_window = window_create(stacking->display); |
|
|
|
} else { |
|
|
|
|
|
|
|
new_window = window_create_transient(stacking->display, |
|
|
|
|
|
|
|
parent_window, 50, 50, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new_widget = window_frame_create(new_window, new_window); |
|
|
|
new_widget = window_frame_create(new_window, new_window); |
|
|
|
|
|
|
|
|
|
|
|
window_set_title(new_window, "Stacking Test"); |
|
|
|
window_set_title(new_window, "Stacking Test"); |
|
|
@ -148,8 +141,7 @@ key_handler(struct window *window, |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case XKB_KEY_n: |
|
|
|
case XKB_KEY_n: |
|
|
|
/* New top-level window. */ |
|
|
|
new_window(stacking); |
|
|
|
new_window(stacking, NULL); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case XKB_KEY_p: |
|
|
|
case XKB_KEY_p: |
|
|
@ -160,11 +152,6 @@ key_handler(struct window *window, |
|
|
|
exit (0); |
|
|
|
exit (0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case XKB_KEY_t: |
|
|
|
|
|
|
|
/* New transient window. */ |
|
|
|
|
|
|
|
new_window(stacking, window); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -234,9 +221,7 @@ draw_string(cairo_t *cr, |
|
|
|
static void |
|
|
|
static void |
|
|
|
set_window_background_colour(cairo_t *cr, struct window *window) |
|
|
|
set_window_background_colour(cairo_t *cr, struct window *window) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (window_is_transient(window)) |
|
|
|
if (window_is_maximized(window)) |
|
|
|
cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.4); |
|
|
|
|
|
|
|
else if (window_is_maximized(window)) |
|
|
|
|
|
|
|
cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 0.6); |
|
|
|
cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 0.6); |
|
|
|
else if (window_is_fullscreen(window)) |
|
|
|
else if (window_is_fullscreen(window)) |
|
|
|
cairo_set_source_rgba(cr, 0.0, 1.0, 1.0, 0.6); |
|
|
|
cairo_set_source_rgba(cr, 0.0, 1.0, 1.0, 0.6); |
|
|
@ -275,12 +260,11 @@ redraw_handler(struct widget *widget, void *data) |
|
|
|
"Window: %p\n" |
|
|
|
"Window: %p\n" |
|
|
|
"Fullscreen? %u\n" |
|
|
|
"Fullscreen? %u\n" |
|
|
|
"Maximized? %u\n" |
|
|
|
"Maximized? %u\n" |
|
|
|
"Transient? %u\n" |
|
|
|
|
|
|
|
"Keys: (f)ullscreen, (m)aximize,\n" |
|
|
|
"Keys: (f)ullscreen, (m)aximize,\n" |
|
|
|
" (n)ew window, (p)opup,\n" |
|
|
|
" (n)ew window, (p)opup,\n" |
|
|
|
" (q)uit, (t)ransient window\n", |
|
|
|
" (q)uit\n", |
|
|
|
window, window_is_fullscreen(window), |
|
|
|
window, window_is_fullscreen(window), |
|
|
|
window_is_maximized(window), window_is_transient(window)); |
|
|
|
window_is_maximized(window)); |
|
|
|
|
|
|
|
|
|
|
|
cairo_destroy(cr); |
|
|
|
cairo_destroy(cr); |
|
|
|
} |
|
|
|
} |
|
|
@ -304,7 +288,7 @@ main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
display_set_user_data(stacking.display, &stacking); |
|
|
|
display_set_user_data(stacking.display, &stacking); |
|
|
|
|
|
|
|
|
|
|
|
stacking.root_window = new_window(&stacking, NULL); |
|
|
|
stacking.root_window = new_window(&stacking); |
|
|
|
|
|
|
|
|
|
|
|
display_run(stacking.display); |
|
|
|
display_run(stacking.display); |
|
|
|
|
|
|
|
|
|
|
|