clients/window: Add functions to set/retrieve app_id

Adds appid for all clients using the toolkit, flower, fullscreen, image,
resizor, scaler, smoke, stacking, subsurfaces, terminal,
touch-calibrator, transformed, etc.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 3 years ago committed by Simon Ser
parent 713f02327d
commit b3544c26ad
  1. 2
      clients/calibrator.c
  2. 2
      clients/clickdot.c
  3. 1
      clients/cliptest.c
  4. 2
      clients/confine.c
  5. 4
      clients/content_protection.c
  6. 2
      clients/dnd.c
  7. 1
      clients/editor.c
  8. 2
      clients/eventdemo.c
  9. 1
      clients/flower.c
  10. 1
      clients/fullscreen.c
  11. 1
      clients/gears.c
  12. 1
      clients/image.c
  13. 2
      clients/keyboard.c
  14. 2
      clients/nested.c
  15. 2
      clients/resizor.c
  16. 1
      clients/scaler.c
  17. 1
      clients/smoke.c
  18. 1
      clients/stacking.c
  19. 2
      clients/subsurfaces.c
  20. 2
      clients/terminal.c
  21. 2
      clients/touch-calibrator.c
  22. 2
      clients/transformed.c
  23. 18
      clients/window.c
  24. 6
      clients/window.h

@ -232,6 +232,8 @@ calibrator_create(struct display *display, bool enable_button)
calibrator->window = window_create(display); calibrator->window = window_create(display);
calibrator->widget = window_add_widget(calibrator->window, calibrator); calibrator->widget = window_add_widget(calibrator->window, calibrator);
window_set_title(calibrator->window, "Wayland calibrator"); window_set_title(calibrator->window, "Wayland calibrator");
window_set_appid(calibrator->window,
"org.freedesktop.weston.wayland-calibrator");
calibrator->display = display; calibrator->display = display;
calibrator->current_test = ARRAY_LENGTH(test_ratios) - 1; calibrator->current_test = ARRAY_LENGTH(test_ratios) - 1;

@ -281,6 +281,8 @@ clickdot_create(struct display *display)
clickdot->window = window_create(display); clickdot->window = window_create(display);
clickdot->widget = window_frame_create(clickdot->window, clickdot); clickdot->widget = window_frame_create(clickdot->window, clickdot);
window_set_title(clickdot->window, "Wayland ClickDot"); window_set_title(clickdot->window, "Wayland ClickDot");
window_set_appid(clickdot->window,
"org.freedesktop.weston.wayland-clickdot");
clickdot->display = display; clickdot->display = display;
clickdot->buffer = NULL; clickdot->buffer = NULL;

@ -522,6 +522,7 @@ cliptest_create(struct display *display)
cliptest->window = window_create(display); cliptest->window = window_create(display);
cliptest->widget = window_frame_create(cliptest->window, cliptest); cliptest->widget = window_frame_create(cliptest->window, cliptest);
window_set_title(cliptest->window, "cliptest"); window_set_title(cliptest->window, "cliptest");
window_set_appid(cliptest->window, "org.freedesktop.weston.cliptest");
cliptest->display = display; cliptest->display = display;
window_set_user_data(cliptest->window, cliptest); window_set_user_data(cliptest->window, cliptest);

@ -423,6 +423,8 @@ confine_create(struct display *display)
confine->window = window_create(display); confine->window = window_create(display);
confine->widget = window_frame_create(confine->window, confine); confine->widget = window_frame_create(confine->window, confine);
window_set_title(confine->window, "Wayland Confine"); window_set_title(confine->window, "Wayland Confine");
window_set_appid(confine->window,
"org.freedesktop.weston.wayland-confine");
confine->display = display; confine->display = display;
confine->buffer = NULL; confine->buffer = NULL;

@ -367,7 +367,9 @@ int main(int argc, char *argv[])
pc_player->enforced = create_button(pc_player, str_type_enforced); pc_player->enforced = create_button(pc_player, str_type_enforced);
pc_player->relaxed = create_button(pc_player, str_type_relaxed); pc_player->relaxed = create_button(pc_player, str_type_relaxed);
window_set_title(pc_player->window, "Player"); window_set_title(pc_player->window, "Weston Content Protection");
window_set_appid(pc_player->window,
"org.freedesktop.weston.weston-content-protection");
widget_set_redraw_handler(pc_player->widget, redraw_handler); widget_set_redraw_handler(pc_player->widget, redraw_handler);
widget_set_resize_handler(pc_player->widget, resize_handler); widget_set_resize_handler(pc_player->widget, resize_handler);
window_schedule_resize(pc_player->window, WIDTH, HEIGHT); window_schedule_resize(pc_player->window, WIDTH, HEIGHT);

@ -789,6 +789,8 @@ dnd_create(struct display *display)
dnd->window = window_create(display); dnd->window = window_create(display);
dnd->widget = window_frame_create(dnd->window, dnd); dnd->widget = window_frame_create(dnd->window, dnd);
window_set_title(dnd->window, "Wayland Drag and Drop Demo"); window_set_title(dnd->window, "Wayland Drag and Drop Demo");
window_set_appid(dnd->window,
"org.freedesktop.weston.wayland-drag-and-drop-demo");
dnd->display = display; dnd->display = display;
dnd->key = 100; dnd->key = 100;

@ -1652,6 +1652,7 @@ main(int argc, char *argv[])
editor.selected_text = NULL; editor.selected_text = NULL;
window_set_title(editor.window, "Text Editor"); window_set_title(editor.window, "Text Editor");
window_set_appid(editor.window, "org.freedesktop.weston.text-editor");
window_set_key_handler(editor.window, key_handler); window_set_key_handler(editor.window, key_handler);
window_set_keyboard_focus_handler(editor.window, window_set_keyboard_focus_handler(editor.window,
keyboard_focus_handler); keyboard_focus_handler);

@ -47,6 +47,7 @@
/** window title */ /** window title */
static char *title = "EventDemo"; static char *title = "EventDemo";
static char *appid = "org.freedesktop.weston.eventdemo";
/** window width */ /** window width */
static int width = 500; static int width = 500;
@ -400,6 +401,7 @@ eventdemo_create(struct display *d)
} else { } else {
e->widget = window_frame_create(e->window, e); e->widget = window_frame_create(e->window, e);
window_set_title(e->window, title); window_set_title(e->window, title);
window_set_appid(e->window, appid);
} }
e->display = d; e->display = d;

@ -187,6 +187,7 @@ int main(int argc, char *argv[])
flower.window = window_create(d); flower.window = window_create(d);
flower.widget = window_add_widget(flower.window, &flower); flower.widget = window_add_widget(flower.window, &flower);
window_set_title(flower.window, "Flower"); window_set_title(flower.window, "Flower");
window_set_appid(flower.window, "org.freedesktop.weston.flower");
widget_set_resize_handler(flower.widget, resize_handler); widget_set_resize_handler(flower.widget, resize_handler);
widget_set_redraw_handler(flower.widget, redraw_handler); widget_set_redraw_handler(flower.widget, redraw_handler);

@ -550,6 +550,7 @@ int main(int argc, char *argv[])
window_add_widget(fullscreen.window, &fullscreen); window_add_widget(fullscreen.window, &fullscreen);
window_set_title(fullscreen.window, "Fullscreen"); window_set_title(fullscreen.window, "Fullscreen");
window_set_appid(fullscreen.window, "org.freedesktop.weston.fullscreen");
widget_set_transparent(fullscreen.widget, 0); widget_set_transparent(fullscreen.widget, 0);

@ -413,6 +413,7 @@ gears_create(struct display *display)
gears->window = window_create(display); gears->window = window_create(display);
gears->widget = window_frame_create(gears->window, gears); gears->widget = window_frame_create(gears->window, gears);
window_set_title(gears->window, "Wayland Gears"); window_set_title(gears->window, "Wayland Gears");
window_set_appid(gears->window, "org.freedesktop.weston.wayland-gears");
gears->display = display_get_egl_display(gears->d); gears->display = display_get_egl_display(gears->d);
if (gears->display == NULL) if (gears->display == NULL)

@ -383,6 +383,7 @@ image_create(struct display *display, const char *filename,
image->window = window_create(display); image->window = window_create(display);
image->widget = window_frame_create(image->window, image); image->widget = window_frame_create(image->window, image);
window_set_title(image->window, title); window_set_title(image->window, title);
window_set_appid(image->window, "org.freedesktop.weston.wayland-image");
image->display = display; image->display = display;
image->image_counter = image_counter; image->image_counter = image_counter;
*image_counter += 1; *image_counter += 1;

@ -1021,6 +1021,8 @@ keyboard_create(struct virtual_keyboard *virtual_keyboard)
virtual_keyboard->keyboard = keyboard; virtual_keyboard->keyboard = keyboard;
window_set_title(keyboard->window, "Virtual keyboard"); window_set_title(keyboard->window, "Virtual keyboard");
window_set_appid(keyboard->window,
"org.freedesktop.weston.virtual-keyboard");
window_set_user_data(keyboard->window, keyboard); window_set_user_data(keyboard->window, keyboard);
widget_set_redraw_handler(keyboard->widget, redraw_handler); widget_set_redraw_handler(keyboard->widget, redraw_handler);

@ -807,6 +807,8 @@ nested_create(struct display *display)
nested->window = window_create(display); nested->window = window_create(display);
nested->widget = window_frame_create(nested->window, nested); nested->widget = window_frame_create(nested->window, nested);
window_set_title(nested->window, "Wayland Nested"); window_set_title(nested->window, "Wayland Nested");
window_set_appid(nested->window,
"org.freedesktop.weston.wayland-nested");
nested->display = display; nested->display = display;
window_set_user_data(nested->window, nested); window_set_user_data(nested->window, nested);

@ -392,6 +392,8 @@ resizor_create(struct display *display)
resizor->window = window_create(display); resizor->window = window_create(display);
resizor->widget = window_frame_create(resizor->window, resizor); resizor->widget = window_frame_create(resizor->window, resizor);
window_set_title(resizor->window, "Wayland Resizor"); window_set_title(resizor->window, "Wayland Resizor");
window_set_appid(resizor->window,
"org.freedesktop.weston.wayland-resizor");
resizor->display = display; resizor->display = display;
window_set_key_handler(resizor->window, key_handler); window_set_key_handler(resizor->window, key_handler);

@ -303,6 +303,7 @@ main(int argc, char *argv[])
box.window = window_create(d); box.window = window_create(d);
box.widget = window_add_widget(box.window, &box); box.widget = window_add_widget(box.window, &box);
window_set_title(box.window, "Scaler Test Box"); window_set_title(box.window, "Scaler Test Box");
window_set_appid(box.window, "org.freedesktop.weston.scaler-test-box");
window_set_buffer_scale(box.window, BUFFER_SCALE); window_set_buffer_scale(box.window, BUFFER_SCALE);
widget_set_resize_handler(box.widget, resize_handler); widget_set_resize_handler(box.widget, resize_handler);

@ -285,6 +285,7 @@ int main(int argc, char *argv[])
smoke.window = window_create(d); smoke.window = window_create(d);
smoke.widget = window_add_widget(smoke.window, &smoke); smoke.widget = window_add_widget(smoke.window, &smoke);
window_set_title(smoke.window, "smoke"); window_set_title(smoke.window, "smoke");
window_set_appid(smoke.window, "org.freedesktop.weston.smoke");
window_set_buffer_type(smoke.window, WINDOW_BUFFER_TYPE_SHM); window_set_buffer_type(smoke.window, WINDOW_BUFFER_TYPE_SHM);
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);

@ -74,6 +74,7 @@ new_window(struct stacking *stacking, struct window *parent_window)
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");
window_set_appid(new_window, "org.freedesktop.weston.stacking-test");
window_set_key_handler(new_window, key_handler); window_set_key_handler(new_window, key_handler);
window_set_keyboard_focus_handler(new_window, keyboard_focus_handler); window_set_keyboard_focus_handler(new_window, keyboard_focus_handler);
window_set_fullscreen_handler(new_window, fullscreen_handler); window_set_fullscreen_handler(new_window, fullscreen_handler);

@ -733,6 +733,8 @@ demoapp_create(struct display *display)
app->window = window_create(app->display); app->window = window_create(app->display);
app->widget = window_frame_create(app->window, app); app->widget = window_frame_create(app->window, app);
window_set_title(app->window, "Wayland Sub-surface Demo"); window_set_title(app->window, "Wayland Sub-surface Demo");
window_set_appid(app->window,
"org.freedesktop.weston.wayland-sub-surface-demo");
window_set_key_handler(app->window, key_handler); window_set_key_handler(app->window, key_handler);
window_set_user_data(app->window, app); window_set_user_data(app->window, app);

@ -2949,6 +2949,8 @@ terminal_create(struct display *display)
terminal->widget = window_frame_create(terminal->window, terminal); terminal->widget = window_frame_create(terminal->window, terminal);
terminal->title = xstrdup("Wayland Terminal"); terminal->title = xstrdup("Wayland Terminal");
window_set_title(terminal->window, terminal->title); window_set_title(terminal->window, terminal->title);
window_set_appid(terminal->window,
"org.freedesktop.weston.wayland-terminal");
widget_set_transparent(terminal->widget, 0); widget_set_transparent(terminal->widget, 0);
init_state_machine(&terminal->state_machine); init_state_machine(&terminal->state_machine);

@ -557,6 +557,8 @@ calibrator_create(struct display *display, const char *match_name)
cal->widget = window_add_widget(cal->window, cal); cal->widget = window_add_widget(cal->window, cal);
window_inhibit_redraw(cal->window); window_inhibit_redraw(cal->window);
window_set_title(cal->window, "Touchscreen calibrator"); window_set_title(cal->window, "Touchscreen calibrator");
window_set_appid(cal->window,
"org.freedesktop.weston.touchscreen-calibrator");
cal->display = display; cal->display = display;
widget_set_redraw_handler(cal->widget, redraw_handler); widget_set_redraw_handler(cal->widget, redraw_handler);

@ -277,6 +277,8 @@ int main(int argc, char *argv[])
window_add_widget(transformed.window, &transformed); window_add_widget(transformed.window, &transformed);
window_set_title(transformed.window, "Transformed"); window_set_title(transformed.window, "Transformed");
window_set_appid(transformed.window,
"org.freedesktop.weston.transformed");
widget_set_transparent(transformed.widget, 0); widget_set_transparent(transformed.widget, 0);
widget_set_default_cursor(transformed.widget, CURSOR_BLANK); widget_set_default_cursor(transformed.widget, CURSOR_BLANK);

@ -230,6 +230,7 @@ struct window {
struct display *display; struct display *display;
struct wl_list window_output_list; struct wl_list window_output_list;
char *title; char *title;
char *appid;
struct rectangle saved_allocation; struct rectangle saved_allocation;
struct rectangle min_allocation; struct rectangle min_allocation;
struct rectangle pending_allocation; struct rectangle pending_allocation;
@ -1609,6 +1610,7 @@ window_destroy(struct window *window)
wl_list_remove(&window->link); wl_list_remove(&window->link);
free(window->title); free(window->title);
free(window->appid);
free(window); free(window);
} }
@ -4826,6 +4828,22 @@ window_get_title(struct window *window)
return window->title; return window->title;
} }
void
window_set_appid(struct window *window, const char *appid)
{
assert(!window->appid);
window->appid = strdup(appid);
if (window->xdg_toplevel)
xdg_toplevel_set_app_id(window->xdg_toplevel, window->appid);
}
const char *
window_get_appid(struct window *window)
{
return window->appid;
}
void void
window_set_text_cursor_position(struct window *window, int32_t x, int32_t y) window_set_text_cursor_position(struct window *window, int32_t x, int32_t y)
{ {

@ -500,9 +500,15 @@ window_set_locked_pointer_motion_handler(
void void
window_set_title(struct window *window, const char *title); window_set_title(struct window *window, const char *title);
void
window_set_appid(struct window *window, const char *appid);
const char * const char *
window_get_title(struct window *window); window_get_title(struct window *window);
const char *
window_get_appid(struct window *window);
void void
window_set_text_cursor_position(struct window *window, int32_t x, int32_t y); window_set_text_cursor_position(struct window *window, int32_t x, int32_t y);

Loading…
Cancel
Save