libgnomedb r1752 - in trunk: . libgnomedb/data-entries



Author: vivien
Date: Tue Oct  7 13:14:42 2008
New Revision: 1752
URL: http://svn.gnome.org/viewvc/libgnomedb?rev=1752&view=rev

Log:
2008-10-07  Vivien Malerba <malerba gnome-db org>

	* libgnomedb/data-entries/gnome-db-entry-common-time.c: make sure the calendar
	popup is always visible.


Modified:
   trunk/ChangeLog
   trunk/libgnomedb/data-entries/gnome-db-entry-common-time.c

Modified: trunk/libgnomedb/data-entries/gnome-db-entry-common-time.c
==============================================================================
--- trunk/libgnomedb/data-entries/gnome-db-entry-common-time.c	(original)
+++ trunk/libgnomedb/data-entries/gnome-db-entry-common-time.c	Tue Oct  7 13:14:42 2008
@@ -798,6 +798,42 @@
         position_popup (mgtim);
         gtk_grab_add (mgtim->priv->window);
         gtk_widget_show (mgtim->priv->window);
+
+	GdkScreen *screen;
+	gint swidth, sheight;
+	gint root_x, root_y;
+	gint wwidth, wheight;
+	gboolean do_move = FALSE;
+	screen = gtk_window_get_screen (GTK_WINDOW (mgtim->priv->window));
+	if (screen) {
+		swidth = gdk_screen_get_width (screen);
+		sheight = gdk_screen_get_height (screen);
+	}
+	else {
+		swidth = gdk_screen_width ();
+		sheight = gdk_screen_height ();
+	}
+	gtk_window_get_position (GTK_WINDOW (mgtim->priv->window), &root_x, &root_y);
+	gtk_window_get_size (GTK_WINDOW (mgtim->priv->window), &wwidth, &wheight);
+	if (root_x + wwidth > swidth) {
+		do_move = TRUE;
+		root_x = swidth - wwidth;
+	}
+	else if (root_x < 0) {
+		do_move = TRUE;
+		root_x = 0;
+	}
+	if (root_y + wheight > sheight) {
+		do_move = TRUE;
+		root_y = sheight - wheight;
+	}
+	else if (root_y < 0) {
+		do_move = TRUE;
+		root_y = 0;
+	}
+	if (do_move)
+		gtk_window_move (GTK_WINDOW (mgtim->priv->window), root_x, root_y);
+
         gtk_widget_grab_focus (mgtim->priv->date);
         popup_grab_on_window (mgtim->priv->window->window,
                               gtk_get_current_event_time ());



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]