[client] x11/wayland: add application id
Some checks failed
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled

This commit is contained in:
rs189 2024-10-12 18:19:02 +02:00 committed by Geoffrey McRae
parent 4e8201da07
commit e25492a3a3
12 changed files with 22 additions and 10 deletions

View file

@ -70,3 +70,4 @@ Zenithal <i@zenithal.me> (ZenithalHourlyRate)
Kamplom <6284968128@protonmail.ch> (kamplom) Kamplom <6284968128@protonmail.ch> (kamplom)
Jacob McNamee <jacob@jacobmcnamee.com> (jacobmcnamee) Jacob McNamee <jacob@jacobmcnamee.com> (jacobmcnamee)
Marco Antonio J. Costa <marco.antonio.costa@gmail.com> (majcosta) Marco Antonio J. Costa <marco.antonio.costa@gmail.com> (majcosta)
rs189 <35667100+rs189@users.noreply.github.com> (rs189)

View file

@ -130,14 +130,14 @@ static void libdecorCallback(uint32_t events, void * opaque)
static bool libdecor_shellInit( static bool libdecor_shellInit(
struct wl_display * display, struct wl_surface * surface, struct wl_display * display, struct wl_surface * surface,
const char * title, bool fullscreen, const char * title, const char * appId, bool fullscreen,
bool maximize, bool borderless, bool resizable) bool maximize, bool borderless, bool resizable)
{ {
state.libdecor = libdecor_new(display, &libdecorListener); state.libdecor = libdecor_new(display, &libdecorListener);
state.libdecorFrame = libdecor_decorate(state.libdecor, surface, state.libdecorFrame = libdecor_decorate(state.libdecor, surface,
&libdecorFrameListener, NULL); &libdecorFrameListener, NULL);
libdecor_frame_set_app_id(state.libdecorFrame, "looking-glass-client"); libdecor_frame_set_app_id(state.libdecorFrame, appId);
libdecor_frame_set_title(state.libdecorFrame, title); libdecor_frame_set_title(state.libdecorFrame, title);
libdecor_frame_map(state.libdecorFrame); libdecor_frame_map(state.libdecorFrame);

View file

@ -130,7 +130,7 @@ static const struct xdg_toplevel_listener xdgToplevelListener = {
}; };
bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface, bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface,
const char * title, bool fullscreen, bool maximize, bool borderless, const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless,
bool resizable) bool resizable)
{ {
if (!state.wmBase) if (!state.wmBase)
@ -147,7 +147,7 @@ bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface,
state.toplevel = xdg_surface_get_toplevel(state.surface); state.toplevel = xdg_surface_get_toplevel(state.surface);
xdg_toplevel_add_listener(state.toplevel, &xdgToplevelListener, NULL); xdg_toplevel_add_listener(state.toplevel, &xdgToplevelListener, NULL);
xdg_toplevel_set_title(state.toplevel, title); xdg_toplevel_set_title(state.toplevel, title);
xdg_toplevel_set_app_id(state.toplevel, "looking-glass-client"); xdg_toplevel_set_app_id(state.toplevel, appId);
if (fullscreen) if (fullscreen)
xdg_toplevel_set_fullscreen(state.toplevel, NULL); xdg_toplevel_set_fullscreen(state.toplevel, NULL);

View file

@ -34,7 +34,7 @@ typedef struct WL_DesktopOps
bool (*shellInit)( bool (*shellInit)(
struct wl_display * display, struct wl_surface * surface, struct wl_display * display, struct wl_surface * surface,
const char * title, bool fullscreen, bool maximize, const char * title, const char * appId, bool fullscreen, bool maximize,
bool borderless, bool resizable); bool borderless, bool resizable);
void (*shellAckConfigureIfNeeded)(void); void (*shellAckConfigureIfNeeded)(void);

View file

@ -159,7 +159,7 @@ static bool waylandInit(const LG_DSInitParams params)
return false; return false;
wlWm.desktop->setSize(params.w, params.h); wlWm.desktop->setSize(params.w, params.h);
if (!waylandWindowInit(params.title, params.fullscreen, params.maximize, if (!waylandWindowInit(params.title, params.appId, params.fullscreen, params.maximize,
params.borderless, params.resizable)) params.borderless, params.resizable))
return false; return false;

View file

@ -301,7 +301,7 @@ bool waylandRegistryInit(void);
void waylandRegistryFree(void); void waylandRegistryFree(void);
// window module // window module
bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool borderless, bool resizable); bool waylandWindowInit(const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless, bool resizable);
void waylandWindowFree(void); void waylandWindowFree(void);
void waylandWindowUpdateScale(void); void waylandWindowUpdateScale(void);
void waylandSetWindowSize(int x, int y); void waylandSetWindowSize(int x, int y);

View file

@ -85,7 +85,7 @@ static const struct wl_surface_listener wlSurfaceListener = {
.leave = wlSurfaceLeaveHandler, .leave = wlSurfaceLeaveHandler,
}; };
bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool borderless, bool resizable) bool waylandWindowInit(const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless, bool resizable)
{ {
wlWm.scale = wl_fixed_from_int(1); wlWm.scale = wl_fixed_from_int(1);
@ -113,7 +113,7 @@ bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool
wl_surface_add_listener(wlWm.surface, &wlSurfaceListener, NULL); wl_surface_add_listener(wlWm.surface, &wlSurfaceListener, NULL);
if (!wlWm.desktop->shellInit(wlWm.display, wlWm.surface, if (!wlWm.desktop->shellInit(wlWm.display, wlWm.surface,
title, fullscreen, maximize, borderless, resizable)) title, appId, fullscreen, maximize, borderless, resizable))
return false; return false;
wl_surface_commit(wlWm.surface); wl_surface_commit(wlWm.surface);

View file

@ -343,7 +343,7 @@ static bool x11Init(const LG_DSInitParams params)
XClassHint hint = XClassHint hint =
{ {
.res_name = strdup(params.title), .res_name = strdup(params.title),
.res_class = strdup("looking-glass-client") .res_class = strdup(params.appId)
}; };
XSetClassHint(x11.display, x11.window, &hint); XSetClassHint(x11.display, x11.window, &hint);
free(hint.res_name); free(hint.res_name);

View file

@ -84,6 +84,7 @@ LG_DSPointer;
typedef struct LG_DSInitParams typedef struct LG_DSInitParams
{ {
const char * title; const char * title;
const char * appId;
int x, y, w, h; int x, y, w, h;
bool center; bool center;
bool fullscreen; bool fullscreen;

View file

@ -112,6 +112,13 @@ static struct Option options[] =
.type = OPTION_TYPE_STRING, .type = OPTION_TYPE_STRING,
.value.x_string = "Looking Glass (client)" .value.x_string = "Looking Glass (client)"
}, },
{
.module = "win",
.name = "appId",
.description = "The application Id",
.type = OPTION_TYPE_STRING,
.value.x_string = "looking-glass-client"
},
{ {
.module = "win", .module = "win",
.name = "position", .name = "position",
@ -649,6 +656,7 @@ bool config_load(int argc, char * argv[])
g_params.allowDMA = option_get_bool ("app" , "allowDMA" ); g_params.allowDMA = option_get_bool ("app" , "allowDMA" );
g_params.windowTitle = option_get_string("win", "title" ); g_params.windowTitle = option_get_string("win", "title" );
g_params.appId = option_get_string("win", "appId" );
g_params.autoResize = option_get_bool ("win", "autoResize" ); g_params.autoResize = option_get_bool ("win", "autoResize" );
g_params.allowResize = option_get_bool ("win", "allowResize" ); g_params.allowResize = option_get_bool ("win", "allowResize" );
g_params.keepAspect = option_get_bool ("win", "keepAspect" ); g_params.keepAspect = option_get_bool ("win", "keepAspect" );

View file

@ -1350,6 +1350,7 @@ static int lg_run(void)
const LG_DSInitParams params = const LG_DSInitParams params =
{ {
.title = g_params.windowTitle, .title = g_params.windowTitle,
.appId = g_params.appId,
.x = g_params.x, .x = g_params.x,
.y = g_params.y, .y = g_params.y,
.w = g_params.w, .w = g_params.w,

View file

@ -211,6 +211,7 @@ struct AppParams
unsigned int forceRendererIndex; unsigned int forceRendererIndex;
const char * windowTitle; const char * windowTitle;
const char * appId;
bool mouseRedraw; bool mouseRedraw;
int mouseSens; int mouseSens;
bool mouseSmoothing; bool mouseSmoothing;