Redo fullscreen code based on code in geeqie
authorJoachim Breitner <mail@joachim-breitner.de>
Sat, 2 Oct 2010 14:22:27 +0000 (14:22 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Sat, 2 Oct 2010 14:22:27 +0000 (14:22 +0000)
sm.c

diff --git a/sm.c b/sm.c
index 88df23d..d0d1fa5 100644 (file)
--- a/sm.c
+++ b/sm.c
@@ -2,6 +2,11 @@
 #     vlshow.c
 #     Copyright (C) 2006 Joachim Breitner
 #
+#     The Code for making a window fullscreen was taken from src/fullscreen.c in
+#     the geeqie package:
+#     Copyright (C) 2004 John Ellis
+#                   2008 - 2010 The Geeqie Team
+#
 #     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 2 of the License, or
@@ -254,9 +259,27 @@ int main(int argc, char **argv) {
        gtk_window_set_icon_name (GTK_WINDOW (window), "sm");
 
        GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(window));
-       gtk_widget_set_size_request(window, gdk_screen_get_width(screen),
-                                           gdk_screen_get_height(screen));
-       gtk_window_fullscreen(GTK_WINDOW(window));
+       int w = gdk_screen_get_width(screen);
+       int h = gdk_screen_get_height(screen);
+
+       GdkGeometry geometry;
+       geometry.min_width = w;
+       geometry.min_height = h;
+       geometry.max_width = w;
+       geometry.max_height = h;
+       geometry.base_width = w;
+       geometry.base_height = h;
+       geometry.win_gravity = GDK_GRAVITY_STATIC;
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), window, &geometry,
+                                     GDK_HINT_MIN_SIZE |
+                                     GDK_HINT_MAX_SIZE |
+                                     GDK_HINT_BASE_SIZE |
+                                     GDK_HINT_WIN_GRAVITY |
+                                     GDK_HINT_USER_POS);
+       gtk_window_set_default_size(GTK_WINDOW(window), w, h);
+       gtk_window_move(GTK_WINDOW(window), 0, 0);
+
+
        g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
        settings = gtk_settings_get_default();