Follow monitors-changed event.
This commit is contained in:
		@ -278,6 +278,13 @@ set_geometry (ServerContext *context)
 | 
				
			|||||||
    gdk_screen_get_monitor_geometry (screen, monitor, &rect);
 | 
					    gdk_screen_get_monitor_geometry (screen, monitor, &rect);
 | 
				
			||||||
    eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds);
 | 
					    eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_signal_handlers_disconnect_by_func (context->window,
 | 
				
			||||||
 | 
					                                          on_realize_set_dock,
 | 
				
			||||||
 | 
					                                          context);
 | 
				
			||||||
 | 
					    g_signal_handlers_disconnect_by_func (context->window,
 | 
				
			||||||
 | 
					                                          on_realize_set_non_maximizable,
 | 
				
			||||||
 | 
					                                          context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (context->fullscreen) {
 | 
					    if (context->fullscreen) {
 | 
				
			||||||
        gint width = rect.width, height = rect.height / 2;
 | 
					        gint width = rect.width, height = rect.height / 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -380,10 +387,9 @@ update_widget (ServerContext *context)
 | 
				
			|||||||
                              _("Keyboard"));
 | 
					                              _("Keyboard"));
 | 
				
			||||||
        gtk_window_set_icon_name (GTK_WINDOW(context->window), "eekboard");
 | 
					        gtk_window_set_icon_name (GTK_WINDOW(context->window), "eekboard");
 | 
				
			||||||
        gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
 | 
					        gtk_window_set_keep_above (GTK_WINDOW(context->window), TRUE);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        set_geometry (context);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    gtk_container_add (GTK_CONTAINER(context->window), context->widget);
 | 
					    gtk_container_add (GTK_CONTAINER(context->window), context->widget);
 | 
				
			||||||
 | 
					    set_geometry (context);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@ -540,9 +546,19 @@ server_context_class_init (ServerContextClass *klass)
 | 
				
			|||||||
                                     pspec);
 | 
					                                     pspec);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					on_monitors_changed (GdkScreen *screen,
 | 
				
			||||||
 | 
					                     gpointer   user_data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ServerContext *context = user_data;
 | 
				
			||||||
 | 
					    if (context->window)
 | 
				
			||||||
 | 
					        set_geometry (context);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
server_context_init (ServerContext *context)
 | 
					server_context_init (ServerContext *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    GdkScreen *screen;
 | 
				
			||||||
    GError *error;
 | 
					    GError *error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context->connection = NULL;
 | 
					    context->connection = NULL;
 | 
				
			||||||
@ -574,6 +590,12 @@ server_context_init (ServerContext *context)
 | 
				
			|||||||
    g_settings_bind (context->settings, "ui-toolkit",
 | 
					    g_settings_bind (context->settings, "ui-toolkit",
 | 
				
			||||||
                     context, "ui-toolkit",
 | 
					                     context, "ui-toolkit",
 | 
				
			||||||
                     G_SETTINGS_BIND_GET);
 | 
					                     G_SETTINGS_BIND_GET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    screen = gdk_screen_get_default ();
 | 
				
			||||||
 | 
					    g_signal_connect (screen,
 | 
				
			||||||
 | 
					                      "monitors-changed",
 | 
				
			||||||
 | 
					                      G_CALLBACK(on_monitors_changed),
 | 
				
			||||||
 | 
					                      context);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user