Merge branch 'some-bugfixes' into 'master'
MERGE these: Some bugfixes - the buildsystem is acting up again See merge request Librem5/squeekboard!53
This commit is contained in:
		@ -150,13 +150,14 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
 | 
				
			|||||||
    rules.layout = strdup(keyboard_type);
 | 
					    rules.layout = strdup(keyboard_type);
 | 
				
			||||||
    struct xkb_keymap *keymap = xkb_keymap_new_from_names(context, &rules,
 | 
					    struct xkb_keymap *keymap = xkb_keymap_new_from_names(context, &rules,
 | 
				
			||||||
        XKB_KEYMAP_COMPILE_NO_FLAGS);
 | 
					        XKB_KEYMAP_COMPILE_NO_FLAGS);
 | 
				
			||||||
 | 
					    xkb_context_unref(context);
 | 
				
			||||||
    if (!keymap) {
 | 
					    if (!keymap) {
 | 
				
			||||||
        g_error("Bad keymap");
 | 
					        g_error("Bad keymap");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    keyboard->keymap = keymap;
 | 
					    keyboard->keymap = keymap;
 | 
				
			||||||
    char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
 | 
					    char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
 | 
				
			||||||
    keyboard->keymap_len = strlen(keymap_str) + 1;
 | 
					    keyboard->keymap_len = strlen(keymap_str) + 1;
 | 
				
			||||||
    char *path = strdup("/eek_keymap-XXXXXX");
 | 
					    g_autofree char *path = strdup("/eek_keymap-XXXXXX");
 | 
				
			||||||
    char *r = &path[strlen(path) - 6];
 | 
					    char *r = &path[strlen(path) - 6];
 | 
				
			||||||
    getrandom(r, 6, GRND_NONBLOCK);
 | 
					    getrandom(r, 6, GRND_NONBLOCK);
 | 
				
			||||||
    for (uint i = 0; i < 6; i++) {
 | 
					    for (uint i = 0; i < 6; i++) {
 | 
				
			||||||
@ -284,6 +285,7 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    g_variant_iter_free(iter);
 | 
					    g_variant_iter_free(iter);
 | 
				
			||||||
 | 
					    g_variant_unref(inputs);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 | 
				
			|||||||
@ -124,18 +124,18 @@ on_notify_keyboard (GObject              *object,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
on_notify_fullscreen (GObject              *object,  // <--- context
 | 
					on_notify_fullscreen (GObject              *object,
 | 
				
			||||||
                      GParamSpec           *spec,
 | 
					                      GParamSpec           *spec,
 | 
				
			||||||
                      ServerContextService *context) // <--- more context
 | 
					                      ServerContextService *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (context->window)
 | 
					    if (context->window)
 | 
				
			||||||
        set_geometry (context);
 | 
					        set_geometry (context);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
on_notify_visible (GObject    *object,            // <--- context
 | 
					on_notify_visible (GObject    *object,
 | 
				
			||||||
                   GParamSpec *spec,
 | 
					                   GParamSpec *spec,
 | 
				
			||||||
                   ServerContextService *context) // <--- more context
 | 
					                   ServerContextService *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gboolean visible;
 | 
					    gboolean visible;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -144,7 +144,7 @@ on_notify_visible (GObject    *object,            // <--- context
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
set_dock (GtkWidget *widget, GtkAllocation *allocation) // <--- FIXME: this could go
 | 
					set_dock (GtkWidget *widget, GtkAllocation *allocation)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef HAVE_XDOCK
 | 
					#ifdef HAVE_XDOCK
 | 
				
			||||||
    GdkWindow *window = gtk_widget_get_window (widget);
 | 
					    GdkWindow *window = gtk_widget_get_window (widget);
 | 
				
			||||||
@ -202,7 +202,7 @@ on_realize_set_non_maximizable (GtkWidget            *widget,
 | 
				
			|||||||
    g_assert (context && context->window == widget);
 | 
					    g_assert (context && context->window == widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* make the window not maximizable */
 | 
					    /* make the window not maximizable */
 | 
				
			||||||
    gdk_window_set_functions (gtk_widget_get_window (widget), // FIXME: This seems to affect #22
 | 
					    gdk_window_set_functions (gtk_widget_get_window (widget),
 | 
				
			||||||
                              GDK_FUNC_RESIZE |
 | 
					                              GDK_FUNC_RESIZE |
 | 
				
			||||||
                              GDK_FUNC_MOVE |
 | 
					                              GDK_FUNC_MOVE |
 | 
				
			||||||
                              GDK_FUNC_MINIMIZE |
 | 
					                              GDK_FUNC_MINIMIZE |
 | 
				
			||||||
@ -305,7 +305,6 @@ make_window (ServerContextService *context)
 | 
				
			|||||||
                          G_CALLBACK(on_notify_visible),
 | 
					                          G_CALLBACK(on_notify_visible),
 | 
				
			||||||
                          context);
 | 
					                          context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // FIXME: these properties could all be set in g_object_new()
 | 
					 | 
				
			||||||
    // The properties below are just to make hacking easier.
 | 
					    // The properties below are just to make hacking easier.
 | 
				
			||||||
    // The way we use layer-shell overrides some,
 | 
					    // The way we use layer-shell overrides some,
 | 
				
			||||||
    // and there's no space in the protocol for others.
 | 
					    // and there's no space in the protocol for others.
 | 
				
			||||||
@ -322,14 +321,13 @@ make_window (ServerContextService *context)
 | 
				
			|||||||
static void
 | 
					static void
 | 
				
			||||||
destroy_window (ServerContextService *context)
 | 
					destroy_window (ServerContextService *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    context->window = NULL; // FIXME: doesn't destroy much
 | 
					    context->window = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
update_widget (ServerContextService *context)
 | 
					update_widget (ServerContextService *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    EekKeyboard *keyboard;
 | 
					    EekKeyboard *keyboard;
 | 
				
			||||||
    EekBounds bounds;
 | 
					 | 
				
			||||||
    EekTheme *theme;
 | 
					    EekTheme *theme;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (context->widget) {
 | 
					    if (context->widget) {
 | 
				
			||||||
@ -342,15 +340,13 @@ update_widget (ServerContextService *context)
 | 
				
			|||||||
                           NULL);
 | 
					                           NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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_clear_object (&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);
 | 
				
			||||||
    gtk_container_add (GTK_CONTAINER(context->window), context->widget);
 | 
					    gtk_container_add (GTK_CONTAINER(context->window), context->widget);
 | 
				
			||||||
    set_geometry (context);
 | 
					    set_geometry (context);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -375,7 +371,7 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context)
 | 
				
			|||||||
    gtk_widget_hide (context->window);
 | 
					    gtk_widget_hide (context->window);
 | 
				
			||||||
    g_clear_pointer (&context->widget, gtk_widget_destroy);
 | 
					    g_clear_pointer (&context->widget, gtk_widget_destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    destroy_window (context); // <--- FIXME: looks suspect
 | 
					    destroy_window (context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
 | 
					    EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
 | 
				
			||||||
        hide_keyboard (_context);
 | 
					        hide_keyboard (_context);
 | 
				
			||||||
@ -492,15 +488,15 @@ server_context_service_init (ServerContextService *context)
 | 
				
			|||||||
                      "monitors-changed",
 | 
					                      "monitors-changed",
 | 
				
			||||||
                      G_CALLBACK(on_monitors_changed),
 | 
					                      G_CALLBACK(on_monitors_changed),
 | 
				
			||||||
                      context);
 | 
					                      context);
 | 
				
			||||||
    g_signal_connect (context,                              // <--- FIXME; here
 | 
					    g_signal_connect (context,
 | 
				
			||||||
                      "notify::keyboard",
 | 
					                      "notify::keyboard",
 | 
				
			||||||
                      G_CALLBACK(on_notify_keyboard),
 | 
					                      G_CALLBACK(on_notify_keyboard),
 | 
				
			||||||
                      context);                             // <--- FIXME: they try to confuse us
 | 
					                      context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_signal_connect (context,                              // <--- FIXME; here
 | 
					    g_signal_connect (context,
 | 
				
			||||||
                      "notify::fullscreen",
 | 
					                      "notify::fullscreen",
 | 
				
			||||||
                      G_CALLBACK(on_notify_fullscreen),
 | 
					                      G_CALLBACK(on_notify_fullscreen),
 | 
				
			||||||
                      context);                             // <--- FIXME: they try to confuse us
 | 
					                      context);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EekboardContextService *
 | 
					EekboardContextService *
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user