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:
		@ -1,7 +1,7 @@
 | 
			
		||||
/* 
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
@ -150,13 +150,14 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
 | 
			
		||||
    rules.layout = strdup(keyboard_type);
 | 
			
		||||
    struct xkb_keymap *keymap = xkb_keymap_new_from_names(context, &rules,
 | 
			
		||||
        XKB_KEYMAP_COMPILE_NO_FLAGS);
 | 
			
		||||
    xkb_context_unref(context);
 | 
			
		||||
    if (!keymap) {
 | 
			
		||||
        g_error("Bad keymap");
 | 
			
		||||
    }
 | 
			
		||||
    keyboard->keymap = keymap;
 | 
			
		||||
    char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
 | 
			
		||||
    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];
 | 
			
		||||
    getrandom(r, 6, GRND_NONBLOCK);
 | 
			
		||||
    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_unref(inputs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
 | 
			
		||||
@ -124,18 +124,18 @@ on_notify_keyboard (GObject              *object,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
on_notify_fullscreen (GObject              *object,  // <--- context
 | 
			
		||||
on_notify_fullscreen (GObject              *object,
 | 
			
		||||
                      GParamSpec           *spec,
 | 
			
		||||
                      ServerContextService *context) // <--- more context
 | 
			
		||||
                      ServerContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    if (context->window)
 | 
			
		||||
        set_geometry (context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
on_notify_visible (GObject    *object,            // <--- context
 | 
			
		||||
on_notify_visible (GObject    *object,
 | 
			
		||||
                   GParamSpec *spec,
 | 
			
		||||
                   ServerContextService *context) // <--- more context
 | 
			
		||||
                   ServerContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    gboolean visible;
 | 
			
		||||
 | 
			
		||||
@ -144,7 +144,7 @@ on_notify_visible (GObject    *object,            // <--- context
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
set_dock (GtkWidget *widget, GtkAllocation *allocation) // <--- FIXME: this could go
 | 
			
		||||
set_dock (GtkWidget *widget, GtkAllocation *allocation)
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_XDOCK
 | 
			
		||||
    GdkWindow *window = gtk_widget_get_window (widget);
 | 
			
		||||
@ -202,7 +202,7 @@ on_realize_set_non_maximizable (GtkWidget            *widget,
 | 
			
		||||
    g_assert (context && context->window == widget);
 | 
			
		||||
 | 
			
		||||
    /* 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_MOVE |
 | 
			
		||||
                              GDK_FUNC_MINIMIZE |
 | 
			
		||||
@ -305,7 +305,6 @@ make_window (ServerContextService *context)
 | 
			
		||||
                          G_CALLBACK(on_notify_visible),
 | 
			
		||||
                          context);
 | 
			
		||||
 | 
			
		||||
    // FIXME: these properties could all be set in g_object_new()
 | 
			
		||||
    // The properties below are just to make hacking easier.
 | 
			
		||||
    // The way we use layer-shell overrides some,
 | 
			
		||||
    // and there's no space in the protocol for others.
 | 
			
		||||
@ -322,16 +321,15 @@ make_window (ServerContextService *context)
 | 
			
		||||
static void
 | 
			
		||||
destroy_window (ServerContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    context->window = NULL; // FIXME: doesn't destroy much
 | 
			
		||||
    context->window = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
update_widget (ServerContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    EekKeyboard *keyboard;
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
    EekTheme *theme;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    if (context->widget) {
 | 
			
		||||
        gtk_widget_destroy (context->widget);
 | 
			
		||||
        context->widget = NULL;
 | 
			
		||||
@ -342,15 +340,13 @@ update_widget (ServerContextService *context)
 | 
			
		||||
                           NULL);
 | 
			
		||||
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
    eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), 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);
 | 
			
		||||
    set_geometry (context);
 | 
			
		||||
}
 | 
			
		||||
@ -375,7 +371,7 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context)
 | 
			
		||||
    gtk_widget_hide (context->window);
 | 
			
		||||
    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)->
 | 
			
		||||
        hide_keyboard (_context);
 | 
			
		||||
@ -492,15 +488,15 @@ server_context_service_init (ServerContextService *context)
 | 
			
		||||
                      "monitors-changed",
 | 
			
		||||
                      G_CALLBACK(on_monitors_changed),
 | 
			
		||||
                      context);
 | 
			
		||||
    g_signal_connect (context,                              // <--- FIXME; here
 | 
			
		||||
    g_signal_connect (context,
 | 
			
		||||
                      "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",
 | 
			
		||||
                      G_CALLBACK(on_notify_fullscreen),
 | 
			
		||||
                      context);                             // <--- FIXME: they try to confuse us
 | 
			
		||||
                      context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
EekboardContextService *
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user