Improve codeflow
This commit is contained in:
@ -213,20 +213,16 @@ on_realize_set_non_maximizable (GtkWidget *widget,
|
|||||||
static void
|
static void
|
||||||
set_geometry (ServerContextService *context)
|
set_geometry (ServerContextService *context)
|
||||||
{
|
{
|
||||||
GdkScreen *screen;
|
GdkScreen *screen = gdk_screen_get_default ();
|
||||||
GdkDisplay *display;
|
GdkWindow *root = gdk_screen_get_root_window (screen);
|
||||||
GdkWindow *root;
|
GdkDisplay *display = gdk_display_get_default ();
|
||||||
GdkMonitor *monitor;
|
GdkMonitor *monitor = gdk_display_get_monitor_at_window (display, root);
|
||||||
|
EekKeyboard *keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||||
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
EekKeyboard *keyboard;
|
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
|
|
||||||
screen = gdk_screen_get_default ();
|
|
||||||
root = gdk_screen_get_root_window (screen);
|
|
||||||
display = gdk_display_get_default();
|
|
||||||
monitor = gdk_display_get_monitor_at_window (display, root);
|
|
||||||
gdk_monitor_get_geometry (monitor, &rect);
|
gdk_monitor_get_geometry (monitor, &rect);
|
||||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
|
||||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (context->window,
|
g_signal_handlers_disconnect_by_func (context->window,
|
||||||
@ -331,23 +327,19 @@ update_widget (ServerContextService *context)
|
|||||||
{
|
{
|
||||||
EekKeyboard *keyboard;
|
EekKeyboard *keyboard;
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
gchar *theme_path;
|
g_autofree gchar *theme_path = g_build_filename (THEMESDIR, "default.css", NULL);
|
||||||
EekTheme *theme;
|
EekTheme *theme;
|
||||||
|
|
||||||
g_clear_pointer (&context->widget, gtk_widget_destroy);
|
|
||||||
|
|
||||||
theme_path = g_build_filename (THEMESDIR, "default.css", NULL);
|
|
||||||
|
|
||||||
theme = eek_theme_new (theme_path, NULL, NULL);
|
theme = eek_theme_new (theme_path, NULL, NULL);
|
||||||
g_free (theme_path);
|
|
||||||
|
|
||||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds); // <--- FIXME: bounds not used
|
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds); // <--- FIXME: bounds not used
|
||||||
|
|
||||||
g_clear_pointer (&context->widget, gtk_widget_destroy);
|
g_clear_pointer (&context->widget, gtk_widget_destroy);
|
||||||
context->widget = eek_gtk_keyboard_new (keyboard);
|
context->widget = eek_gtk_keyboard_new (keyboard);
|
||||||
|
|
||||||
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
|
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
|
||||||
g_object_unref (theme);
|
g_clear_object (&theme);
|
||||||
|
|
||||||
gtk_widget_set_has_tooltip (context->widget, TRUE); // <--- FIXME: I've never seen one
|
gtk_widget_set_has_tooltip (context->widget, TRUE); // <--- FIXME: I've never seen one
|
||||||
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
|
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
|
||||||
|
|||||||
Reference in New Issue
Block a user