window: Make window frame menu available to client
This commit is contained in:
+16
-8
@@ -1334,6 +1334,21 @@ frame_menu_func(struct window *window, int index, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_show_frame_menu(struct window *window,
|
||||||
|
struct input *input, uint32_t time)
|
||||||
|
{
|
||||||
|
int32_t x, y;
|
||||||
|
|
||||||
|
static const char *entries[] = {
|
||||||
|
"Close", "Fullscreen", "Rotate", "Scale"
|
||||||
|
};
|
||||||
|
|
||||||
|
input_get_position(input, &x, &y);
|
||||||
|
window_show_menu(window->display, input, time, window,
|
||||||
|
x - 10, y - 10, frame_menu_func, entries, 4);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
frame_enter_handler(struct widget *widget,
|
frame_enter_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
struct input *input, uint32_t time,
|
||||||
@@ -1359,11 +1374,6 @@ frame_button_handler(struct widget *widget,
|
|||||||
struct frame *frame = data;
|
struct frame *frame = data;
|
||||||
struct window *window = widget->window;
|
struct window *window = widget->window;
|
||||||
int location;
|
int location;
|
||||||
int32_t x, y;
|
|
||||||
static const char *entries[] = {
|
|
||||||
"Close", "Fullscreen", "Rotate", "Scale"
|
|
||||||
};
|
|
||||||
|
|
||||||
location = frame_get_pointer_location(frame, input->sx, input->sy);
|
location = frame_get_pointer_location(frame, input->sx, input->sy);
|
||||||
|
|
||||||
if (window->display->shell && button == BTN_LEFT && state == 1) {
|
if (window->display->shell && button == BTN_LEFT && state == 1) {
|
||||||
@@ -1394,9 +1404,7 @@ frame_button_handler(struct widget *widget,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (button == BTN_RIGHT && state == 1) {
|
} else if (button == BTN_RIGHT && state == 1) {
|
||||||
input_get_position(input, &x, &y);
|
window_show_frame_menu(window, input, time);
|
||||||
window_show_menu(window->display, input, time, window,
|
|
||||||
x - 10, y - 10, frame_menu_func, entries, 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,10 @@ window_show_menu(struct display *display,
|
|||||||
int32_t x, int32_t y,
|
int32_t x, int32_t y,
|
||||||
menu_func_t func, const char **entries, int count);
|
menu_func_t func, const char **entries, int count);
|
||||||
|
|
||||||
|
void
|
||||||
|
window_show_frame_menu(struct window *window,
|
||||||
|
struct input *input, uint32_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
window_destroy(struct window *window);
|
window_destroy(struct window *window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user