From 49168d83eb7e3ab3fea0a9f570dd82ac5181ef34 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 31 Jan 2013 09:46:53 -0700 Subject: [PATCH] gtk-screen: Unset GtkPanedView positions when resizing windows. --- src/gtk-screen/gtk-screen.pkg | 4 +++- src/gtk-screen/gtk-screen.scm | 7 +++++++ src/gtk/Includes/gtkpaned.cdecl | 11 ++++++++++- src/gtk/gtk-widget.scm | 8 +++++++- src/gtk/gtk.pkg | 3 ++- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/gtk-screen/gtk-screen.pkg b/src/gtk-screen/gtk-screen.pkg index 269af10a2..40b392957 100644 --- a/src/gtk-screen/gtk-screen.pkg +++ b/src/gtk-screen/gtk-screen.pkg @@ -86,7 +86,7 @@ USA. (import (gtk gtk-widget) gtk-widget-destroy-callback gtk-container-reverse-children - gtk-paned-view-init) + gtk-paned-view-init) (import (gtk fix-layout) fix-widget-geometry @@ -133,8 +133,10 @@ USA. gtk-scrolled-window-set-policy gtk-scrolled-window-set-placement gtk-scrolled-view-new + gtk-paned? gtk-paned-pack1 gtk-paned-pack2 gtk-paned-get-child1 gtk-paned-get-child2 + gtk-paned-set-position gtk-paned-view-new gtk-window-new diff --git a/src/gtk-screen/gtk-screen.scm b/src/gtk-screen/gtk-screen.scm index d31dbf3f1..4e0f773b6 100644 --- a/src/gtk-screen/gtk-screen.scm +++ b/src/gtk-screen/gtk-screen.scm @@ -890,6 +890,13 @@ USA. "("width"x"height")" " to "window-x-size"x"window-y-size" " "("new-width"x"new-height")\n") + (let unset-pos ((w (gtk-screen-toplevel screen))) + (if (gtk-container? w) + (begin + (for-each unset-pos + (gtk-container-reverse-children w)) + (if (gtk-paned? w) + (gtk-paned-set-position w -1))))) (set-scm-widget-natural-size! widget new-width new-height) (gtk-widget-queue-resize-no-redraw widget)))))))) diff --git a/src/gtk/Includes/gtkpaned.cdecl b/src/gtk/Includes/gtkpaned.cdecl index b67011e18..846444ae5 100644 --- a/src/gtk/Includes/gtkpaned.cdecl +++ b/src/gtk/Includes/gtkpaned.cdecl @@ -18,4 +18,13 @@ gtk-3.0/gtk/gtkpaned.h |# (paned (* GtkPaned)) (child (* GtkWidget)) (resize gboolean) - (shrink gboolean)) \ No newline at end of file + (shrink gboolean)) + +(extern gint + gtk_paned_get_position + (paned (* GtkPaned))) + +(extern void + gtk_paned_set_position + (paned (* GtkPaned)) + (position gint)) \ No newline at end of file diff --git a/src/gtk/gtk-widget.scm b/src/gtk/gtk-widget.scm index 4c3b46998..407b3b737 100644 --- a/src/gtk/gtk-widget.scm +++ b/src/gtk/gtk-widget.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Matthew Birkholz +Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Matthew Birkholz This file is part of an extension to MIT/GNU Scheme. @@ -768,6 +768,12 @@ USA. (C-call "gtk_paned_pack2" (gobject-alien paned) (gobject-alien child2) (if resize? 1 0) (if shrink? 1 0))) +(define (gtk-paned-get-position paned) + (C-call "gtk_paned_get_position" (gobject-alien paned))) + +(define (gtk-paned-set-position paned child1-size) + (C-call "gtk_paned_set_position" (gobject-alien paned) child1-size)) + (define-class ( (constructor ())) ()) diff --git a/src/gtk/gtk.pkg b/src/gtk/gtk.pkg index c3aa43dcd..a2e690e39 100644 --- a/src/gtk/gtk.pkg +++ b/src/gtk/gtk.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Matthew Birkholz +Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Matthew Birkholz This file is part of an extension to MIT/GNU Scheme. @@ -214,6 +214,7 @@ USA. gtk-paned? gtk-paned-new gtk-paned-pack1 gtk-paned-pack2 gtk-paned-get-child1 gtk-paned-get-child2 + gtk-paned-get-position gtk-paned-set-position gtk-paned-view? gtk-paned-view-new) (import (gtk pango) make-pango-layout guarantee-pango-font-description)) -- 2.25.1