[Xfce4-commits] <parole:bluesabre/gtk3> Do not save window size when maximizing
Sean Davis
noreply at xfce.org
Sat Sep 14 14:00:01 CEST 2013
Updating branch refs/heads/bluesabre/gtk3
to 47326162d61d91bddbba2865bc01f72bb0eaa810 (commit)
from 0abb84efc45f142e15dd5f99cdcf7c81438cc58f (commit)
commit 47326162d61d91bddbba2865bc01f72bb0eaa810
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Sep 14 07:48:09 2013 -0400
Do not save window size when maximizing
src/parole-player.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/src/parole-player.c b/src/parole-player.c
index e2246b5..838ddff 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -381,6 +381,7 @@ struct ParolePlayerPrivate
gboolean embedded;
gboolean full_screen;
+ gint last_h, last_w;
ParoleState state;
gboolean user_seeking;
@@ -1869,6 +1870,15 @@ parole_player_window_state_event (GtkWidget *widget,
ParolePlayer *player)
{
gboolean fullscreen = FALSE;
+
+ if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
+ {
+ /* Restore the previously saved window size if maximized */
+ g_object_set (G_OBJECT (player->priv->conf),
+ "window-width", player->priv->last_w,
+ "window-height", player->priv->last_h,
+ NULL);
+ }
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
fullscreen = TRUE;
@@ -2667,15 +2677,29 @@ on_content_area_size_allocate (GtkWidget *widget, GtkAllocation *allocation, Par
gboolean
parole_player_configure_event_cb (GtkWidget *widget, GdkEventConfigure *ev, ParolePlayer *player)
{
- gint w,h;
+ gint old_w, old_h, new_w, new_h;
if ( !player->priv->full_screen )
{
- gtk_window_get_size (GTK_WINDOW (widget), &w, &h);
- g_object_set (G_OBJECT (player->priv->conf),
- "window-width", w,
- "window-height", h,
+ /* Store the previously saved window size in case of maximize */
+ g_object_get (G_OBJECT (player->priv->conf),
+ "window-width", &old_w,
+ "window-height", &old_h,
NULL);
+
+ /* Get the current window size */
+ gtk_window_get_size (GTK_WINDOW (widget), &new_w, &new_h);
+
+ /* Configure gets run twice, only change on update */
+ if (old_w != new_w || old_h != new_h)
+ {
+ player->priv->last_w = old_w;
+ player->priv->last_h = old_h;
+ g_object_set (G_OBJECT (player->priv->conf),
+ "window-width", new_w,
+ "window-height", new_h,
+ NULL);
+ }
}
return FALSE;
@@ -3264,6 +3288,9 @@ parole_player_init (ParolePlayer *player)
"window-width", &w,
"window-height", &h,
NULL);
+
+ player->priv->last_w = w;
+ player->priv->last_h = h;
parole_player_set_playlist_visible(player, showhide);
More information about the Xfce4-commits
mailing list