From 5bb20e44fba3e3c9a5e4a1aa3306805ab6394fd4 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 13 Jun 2011 16:48:56 +0900 Subject: [PATCH] Place keyboard at the center of screen if fullscreen mode is enabled. --- src/server-context.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/server-context.c b/src/server-context.c index 2871a0d0..a885a678 100644 --- a/src/server-context.c +++ b/src/server-context.c @@ -225,14 +225,20 @@ set_geometry (ServerContext *context) eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds); if (context->fullscreen) { + guint width = rect.width, height = rect.height / 2; + + if (width * bounds.height > height * bounds.width) + width = (height / bounds.height) * bounds.width; + else + height = (width / bounds.width) * bounds.height; + + gtk_widget_set_size_request (context->widget, width, height); + gtk_window_move (GTK_WINDOW(context->window), + (rect.width - width) / 2, + rect.height - height); + gtk_window_set_decorated (GTK_WINDOW(context->window), FALSE); gtk_window_set_resizable (GTK_WINDOW(context->window), FALSE); - gtk_widget_set_size_request (context->widget, - rect.width, - rect.height / 2); - gtk_window_move (GTK_WINDOW(context->window), - 0, - rect.height / 2); gtk_window_set_opacity (GTK_WINDOW(context->window), 0.8); } else { if (context->ui_toolkit == UI_TOOLKIT_CLUTTER) {