[digesting_libdecor] lift DBus desktop-settings out of gtk plugin
parent
9a043fb9c9
commit
cdedd70a3b
|
|
@ -249,6 +249,15 @@ libdecorevent__frame_bounds(struct libdecor_frame *frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
/* get desktop settings */
|
||||||
|
{
|
||||||
|
ctx.color_scheme = libdecor_get_color_scheme();
|
||||||
|
if (libdecor_get_cursor_settings(&ctx.cursor_theme_name, &ctx.cursor_size)){
|
||||||
|
ctx.cursor_theme_name = 0;
|
||||||
|
ctx.cursor_size = 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*~ NOTE:
|
/*~ NOTE:
|
||||||
**~ initialize Wayland, Libdecor, & EGL
|
**~ initialize Wayland, Libdecor, & EGL
|
||||||
*/
|
*/
|
||||||
|
|
@ -295,7 +304,6 @@ int main(){
|
||||||
|
|
||||||
/* setup GTK context */
|
/* setup GTK context */
|
||||||
int gtk_init_success = 0;
|
int gtk_init_success = 0;
|
||||||
enum libdecor_color_scheme color_scheme = 0;
|
|
||||||
if (ctx.wl_display != 0 && ctx.wl_compositor != 0){
|
if (ctx.wl_display != 0 && ctx.wl_compositor != 0){
|
||||||
gdk_set_allowed_backends("wayland");
|
gdk_set_allowed_backends("wayland");
|
||||||
gtk_disable_setlocale();
|
gtk_disable_setlocale();
|
||||||
|
|
@ -303,10 +311,9 @@ int main(){
|
||||||
gtk_init_success = 1;
|
gtk_init_success = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
color_scheme = libdecor_get_color_scheme();
|
|
||||||
g_object_set(gtk_settings_get_default(),
|
g_object_set(gtk_settings_get_default(),
|
||||||
"gtk-application-prefer-dark-theme",
|
"gtk-application-prefer-dark-theme",
|
||||||
(color_scheme == LIBDECOR_COLOR_SCHEME_PREFER_DARK), NULL);
|
(ctx.color_scheme == LIBDECOR_COLOR_SCHEME_PREFER_DARK), NULL);
|
||||||
|
|
||||||
if (!gtk_init_success){
|
if (!gtk_init_success){
|
||||||
printf("failed to initialize gtk\n");
|
printf("failed to initialize gtk\n");
|
||||||
|
|
@ -331,13 +338,6 @@ int main(){
|
||||||
wl_list_init(&plugin_gtk->seat_list);
|
wl_list_init(&plugin_gtk->seat_list);
|
||||||
wl_list_init(&plugin_gtk->output_list);
|
wl_list_init(&plugin_gtk->output_list);
|
||||||
|
|
||||||
/* fetch cursor theme and size*/
|
|
||||||
if (!libdecor_get_cursor_settings(&plugin_gtk->cursor_theme_name,
|
|
||||||
&plugin_gtk->cursor_size)){
|
|
||||||
plugin_gtk->cursor_theme_name = 0;
|
|
||||||
plugin_gtk->cursor_size = 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin_gtk->wl_registry = wl_display_get_registry(ctx.wl_display);
|
plugin_gtk->wl_registry = wl_display_get_registry(ctx.wl_display);
|
||||||
wl_registry_add_listener(plugin_gtk->wl_registry,
|
wl_registry_add_listener(plugin_gtk->wl_registry,
|
||||||
®istry_listener, plugin_gtk);
|
®istry_listener, plugin_gtk);
|
||||||
|
|
@ -2701,8 +2701,6 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
||||||
wl_list_remove(&frame->link);
|
wl_list_remove(&frame->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(plugin_gtk->cursor_theme_name);
|
|
||||||
|
|
||||||
if (plugin_gtk->wl_shm)
|
if (plugin_gtk->wl_shm)
|
||||||
wl_shm_destroy(plugin_gtk->wl_shm);
|
wl_shm_destroy(plugin_gtk->wl_shm);
|
||||||
|
|
||||||
|
|
@ -4207,8 +4205,7 @@ ensure_cursor_theme(struct seat *seat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
seat->cursor_scale = scale;
|
seat->cursor_scale = scale;
|
||||||
theme = wl_cursor_theme_load(plugin_gtk->cursor_theme_name,
|
theme = wl_cursor_theme_load(ctx.cursor_theme_name, ctx.cursor_size*scale,
|
||||||
plugin_gtk->cursor_size * scale,
|
|
||||||
plugin_gtk->wl_shm);
|
plugin_gtk->wl_shm);
|
||||||
if (theme == NULL)
|
if (theme == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -450,9 +450,6 @@ struct libdecor_plugin_gtk {
|
||||||
struct wl_list seat_list;
|
struct wl_list seat_list;
|
||||||
struct wl_list output_list;
|
struct wl_list output_list;
|
||||||
|
|
||||||
char *cursor_theme_name;
|
|
||||||
int cursor_size;
|
|
||||||
|
|
||||||
int double_click_time_ms;
|
int double_click_time_ms;
|
||||||
int drag_threshold;
|
int drag_threshold;
|
||||||
|
|
||||||
|
|
@ -621,6 +618,11 @@ static void output_removed(struct libdecor_plugin_gtk *plugin_gtk, struct output
|
||||||
// digesting_libdecor
|
// digesting_libdecor
|
||||||
|
|
||||||
typedef struct Ctx{
|
typedef struct Ctx{
|
||||||
|
/* desktop settings */
|
||||||
|
enum libdecor_color_scheme color_scheme;
|
||||||
|
char *cursor_theme_name;
|
||||||
|
int cursor_size;
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_registry *wl_registry;
|
struct wl_registry *wl_registry;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue