gedit r6832 - in trunk: . gedit
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6832 - in trunk: . gedit
- Date: Sat, 10 Jan 2009 14:39:17 +0000 (UTC)
Author: icq
Date: Sat Jan 10 14:39:17 2009
New Revision: 6832
URL: http://svn.gnome.org/viewvc/gedit?rev=6832&view=rev
Log:
2009-01-10 Ignacio Casal Quinteiro <nacho resa gmail com>
* gedit/gedit-window-private.h:
* gedit/gedit-window.c:
Add animation to fullscreen controls.
Modified:
trunk/ChangeLog
trunk/gedit/gedit-window-private.h
trunk/gedit/gedit-window.c
Modified: trunk/gedit/gedit-window-private.h
==============================================================================
--- trunk/gedit/gedit-window-private.h (original)
+++ trunk/gedit/gedit-window-private.h Sat Jan 10 14:39:17 2009
@@ -56,6 +56,8 @@
/* Widgets for fullscreen mode */
GtkWidget *fullscreen_controls;
+ guint fullscreen_animation_timeout_id;
+ gboolean fullscreen_animation_enter;
/* statusbar and context ids for statusbar messages */
GtkWidget *statusbar;
Modified: trunk/gedit/gedit-window.c
==============================================================================
--- trunk/gedit/gedit-window.c (original)
+++ trunk/gedit/gedit-window.c Sat Jan 10 14:39:17 2009
@@ -61,6 +61,7 @@
#define GEDIT_UIFILE "gedit-ui.xml"
#define TAB_WIDTH_DATA "GeditWindowTabWidthData"
#define LANGUAGE_DATA "GeditWindowLanguageData"
+#define FULLSCREEN_ANIMATION_SPEED 4
#define GEDIT_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
GEDIT_TYPE_WINDOW, \
@@ -173,6 +174,12 @@
window->priv->dispose_has_run = TRUE;
}
+ if (window->priv->fullscreen_animation_timeout_id != 0)
+ {
+ g_source_remove (window->priv->fullscreen_animation_timeout_id);
+ window->priv->fullscreen_animation_timeout_id = 0;
+ }
+
if (window->priv->fullscreen_controls != NULL)
{
gtk_widget_destroy (window->priv->fullscreen_controls);
@@ -2756,23 +2763,109 @@
}
static gboolean
-on_fullscreen_controls_enter_notify_event (GtkWidget *widget,
- GdkEventCrossing *event,
- GeditWindow *window)
+run_fullscreen_animation (gpointer data)
{
+ GeditWindow *window = GEDIT_WINDOW (data);
GdkScreen *screen;
GdkRectangle fs_rect;
-
- if (event->type != GDK_ENTER_NOTIFY)
- return FALSE;
-
+ gint x, y;
+
screen = gtk_window_get_screen (GTK_WINDOW (window));
gdk_screen_get_monitor_geometry (screen,
gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
&fs_rect);
+
+ gtk_window_get_position (GTK_WINDOW (window->priv->fullscreen_controls),
+ &x, &y);
+
+ if (window->priv->fullscreen_animation_enter)
+ {
+ if (y == fs_rect.y)
+ {
+ window->priv->fullscreen_animation_timeout_id = 0;
+ return FALSE;
+ }
+ else
+ {
+ gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
+ x, y + 1);
+ return TRUE;
+ }
+ }
+ else
+ {
+ gint w, h;
+
+ gtk_window_get_size (GTK_WINDOW (window->priv->fullscreen_controls),
+ &w, &h);
+
+ if (y == fs_rect.y - h + 1)
+ {
+ window->priv->fullscreen_animation_timeout_id = 0;
+ return FALSE;
+ }
+ else
+ {
+ gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
+ x, y - 1);
+ return TRUE;
+ }
+ }
+}
+
+static void
+show_hide_fullscreen_toolbar (GeditWindow *window,
+ gboolean show,
+ gint height)
+{
+ GtkSettings *settings;
+ gboolean enable_animations;
+
+ settings = gtk_widget_get_settings (GTK_WIDGET (window));
+ g_object_get (G_OBJECT (settings),
+ "gtk-enable-animations",
+ &enable_animations,
+ NULL);
+
+ if (enable_animations)
+ {
+ window->priv->fullscreen_animation_enter = show;
+
+ if (window->priv->fullscreen_animation_timeout_id == 0)
+ {
+ window->priv->fullscreen_animation_timeout_id =
+ g_timeout_add (FULLSCREEN_ANIMATION_SPEED,
+ (GSourceFunc) run_fullscreen_animation,
+ window);
+ }
+ }
+ else
+ {
+ GdkRectangle fs_rect;
+ GdkScreen *screen;
+
+ screen = gtk_window_get_screen (GTK_WINDOW (window));
+ gdk_screen_get_monitor_geometry (screen,
+ gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
+ &fs_rect);
+
+ if (show)
+ gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
+ fs_rect.x, fs_rect.y);
+ else
+ gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
+ fs_rect.x, fs_rect.y - height + 1);
+ }
+
+}
+
+static gboolean
+on_fullscreen_controls_enter_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event,
+ GeditWindow *window)
+{
+ show_hide_fullscreen_toolbar (window, TRUE, 0);
- gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
- fs_rect.x, fs_rect.y);
return FALSE;
}
@@ -2783,15 +2876,11 @@
{
GdkDisplay *display;
GdkScreen *screen;
- GdkRectangle fs_rect;
gint w, h;
gint x, y;
display = gdk_display_get_default ();
screen = gtk_window_get_screen (GTK_WINDOW (window));
- gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (window)->window),
- &fs_rect);
gtk_window_get_size (GTK_WINDOW (window->priv->fullscreen_controls), &w, &h);
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
@@ -2800,9 +2889,10 @@
* work around it by checking the coordinates
*/
if (y >= h)
- gtk_window_move (GTK_WINDOW (window->priv->fullscreen_controls),
- fs_rect.x, fs_rect.y - h + 1);
-
+ {
+ show_hide_fullscreen_toolbar (window, FALSE, h);
+ }
+
return FALSE;
}
@@ -3599,6 +3689,7 @@
window->priv->state = GEDIT_WINDOW_STATE_NORMAL;
window->priv->dispose_has_run = FALSE;
window->priv->fullscreen_controls = NULL;
+ window->priv->fullscreen_animation_timeout_id = 0;
window->priv->message_bus = gedit_message_bus_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]