mirror of https://github.com/fltk/fltk
Update libdecor to commit 7807ae34 dated 15-Jan-2024
This commit is contained in:
parent
e5abb3bc86
commit
266bf1d3c0
|
@ -29,6 +29,23 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
static bool
|
||||||
|
get_cursor_settings_from_env(char **theme, int *size)
|
||||||
|
{
|
||||||
|
char *env_xtheme;
|
||||||
|
char *env_xsize;
|
||||||
|
|
||||||
|
env_xtheme = getenv("XCURSOR_THEME");
|
||||||
|
if (env_xtheme != NULL)
|
||||||
|
*theme = strdup(env_xtheme);
|
||||||
|
|
||||||
|
env_xsize = getenv("XCURSOR_SIZE");
|
||||||
|
if (env_xsize != NULL)
|
||||||
|
*size = atoi(env_xsize);
|
||||||
|
|
||||||
|
return env_xtheme != NULL && env_xsize != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAS_DBUS
|
#ifdef HAS_DBUS
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
|
|
||||||
|
@ -116,15 +133,15 @@ libdecor_get_cursor_settings(char **theme, int *size)
|
||||||
connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
|
connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
|
||||||
|
|
||||||
if (dbus_error_is_set(&error))
|
if (dbus_error_is_set(&error))
|
||||||
return false;
|
goto fallback;
|
||||||
|
|
||||||
reply = get_setting_sync(connection, name, key_theme);
|
reply = get_setting_sync(connection, name, key_theme);
|
||||||
if (!reply)
|
if (!reply)
|
||||||
return false;
|
goto fallback;
|
||||||
|
|
||||||
if (!parse_type(reply, DBUS_TYPE_STRING, &value_theme)) {
|
if (!parse_type(reply, DBUS_TYPE_STRING, &value_theme)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
return false;
|
goto fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
*theme = strdup(value_theme);
|
*theme = strdup(value_theme);
|
||||||
|
@ -133,32 +150,24 @@ libdecor_get_cursor_settings(char **theme, int *size)
|
||||||
|
|
||||||
reply = get_setting_sync(connection, name, key_size);
|
reply = get_setting_sync(connection, name, key_size);
|
||||||
if (!reply)
|
if (!reply)
|
||||||
return false;
|
goto fallback;
|
||||||
|
|
||||||
if (!parse_type(reply, DBUS_TYPE_INT32, size)) {
|
if (!parse_type(reply, DBUS_TYPE_INT32, size)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
return false;
|
goto fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
fallback:
|
||||||
|
return get_cursor_settings_from_env(theme, size);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool
|
bool
|
||||||
libdecor_get_cursor_settings(char **theme, int *size)
|
libdecor_get_cursor_settings(char **theme, int *size)
|
||||||
{
|
{
|
||||||
char *env_xtheme;
|
return get_cursor_settings_from_env(theme, size);
|
||||||
char *env_xsize;
|
|
||||||
|
|
||||||
env_xtheme = getenv("XCURSOR_THEME");
|
|
||||||
if (env_xtheme != NULL)
|
|
||||||
*theme = strdup(env_xtheme);
|
|
||||||
|
|
||||||
env_xsize = getenv("XCURSOR_SIZE");
|
|
||||||
if (env_xsize != NULL)
|
|
||||||
*size = atoi(env_xsize);
|
|
||||||
|
|
||||||
return env_xtheme != NULL && env_xsize != NULL;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2074,10 +2074,10 @@ component_edge(const struct border_component *cmpnt,
|
||||||
const int pointer_y,
|
const int pointer_y,
|
||||||
const int margin)
|
const int margin)
|
||||||
{
|
{
|
||||||
const bool top = pointer_y < margin;
|
const bool top = pointer_y < margin * 2;
|
||||||
const bool bottom = pointer_y > (cmpnt->server.buffer->height - margin);
|
const bool bottom = pointer_y > (cmpnt->server.buffer->height - margin * 2);
|
||||||
const bool left = pointer_x < margin;
|
const bool left = pointer_x < margin * 2;
|
||||||
const bool right = pointer_x > (cmpnt->server.buffer->width - margin);
|
const bool right = pointer_x > (cmpnt->server.buffer->width - margin * 2);
|
||||||
|
|
||||||
if (top)
|
if (top)
|
||||||
if (left)
|
if (left)
|
||||||
|
|
|
@ -421,6 +421,7 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
||||||
free(cursor_output);
|
free(cursor_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(seat->name);
|
||||||
free(seat);
|
free(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +450,7 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
||||||
if (plugin_gtk->wl_subcompositor)
|
if (plugin_gtk->wl_subcompositor)
|
||||||
wl_subcompositor_destroy(plugin_gtk->wl_subcompositor);
|
wl_subcompositor_destroy(plugin_gtk->wl_subcompositor);
|
||||||
|
|
||||||
|
libdecor_plugin_release(&plugin_gtk->plugin);
|
||||||
free(plugin_gtk);
|
free(plugin_gtk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,24 +674,16 @@ libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin,
|
||||||
struct libdecor_frame_gtk *frame_gtk =
|
struct libdecor_frame_gtk *frame_gtk =
|
||||||
(struct libdecor_frame_gtk *) frame;
|
(struct libdecor_frame_gtk *) frame;
|
||||||
|
|
||||||
/* when in SSD mode, frame_gtk->header is not a proper GTK widget */
|
g_clear_pointer (&frame_gtk->header, gtk_widget_destroy);
|
||||||
if (!GTK_IS_WIDGET(frame_gtk->header)) return;
|
g_clear_pointer (&frame_gtk->window, gtk_widget_destroy);
|
||||||
gtk_widget_destroy(frame_gtk->header);
|
|
||||||
frame_gtk->header = NULL;
|
|
||||||
if (!GTK_IS_WIDGET(frame_gtk->window)) return;
|
|
||||||
gtk_widget_destroy(frame_gtk->window);
|
|
||||||
frame_gtk->window = NULL;
|
|
||||||
|
|
||||||
free_border_component(&frame_gtk->headerbar);
|
free_border_component(&frame_gtk->headerbar);
|
||||||
free_border_component(&frame_gtk->shadow);
|
free_border_component(&frame_gtk->shadow);
|
||||||
frame_gtk->shadow_showing = false;
|
frame_gtk->shadow_showing = false;
|
||||||
if (frame_gtk->shadow_blur != NULL) {
|
|
||||||
cairo_surface_destroy(frame_gtk->shadow_blur);
|
|
||||||
frame_gtk->shadow_blur = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(frame_gtk->title);
|
g_clear_pointer (&frame_gtk->shadow_blur, cairo_surface_destroy);
|
||||||
frame_gtk->title = NULL;
|
|
||||||
|
g_clear_pointer (&frame_gtk->title, free);
|
||||||
|
|
||||||
frame_gtk->decoration_type = DECORATION_TYPE_NONE;
|
frame_gtk->decoration_type = DECORATION_TYPE_NONE;
|
||||||
|
|
||||||
|
@ -1966,10 +1959,10 @@ component_edge(const struct border_component *cmpnt,
|
||||||
const int pointer_y,
|
const int pointer_y,
|
||||||
const int margin)
|
const int margin)
|
||||||
{
|
{
|
||||||
const bool top = pointer_y < margin;
|
const bool top = pointer_y < margin * 2;
|
||||||
const bool bottom = pointer_y > (cmpnt->buffer->height - margin);
|
const bool bottom = pointer_y > (cmpnt->buffer->height - margin * 2);
|
||||||
const bool left = pointer_x < margin;
|
const bool left = pointer_x < margin * 2;
|
||||||
const bool right = pointer_x > (cmpnt->buffer->width - margin);
|
const bool right = pointer_x > (cmpnt->buffer->width - margin * 2);
|
||||||
|
|
||||||
if (top) {
|
if (top) {
|
||||||
if (left)
|
if (left)
|
||||||
|
|
Loading…
Reference in New Issue