summaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-08-06 07:58:49 +0000
committerrhp <rhp>2001-08-06 07:58:49 +0000
commit11b14d327f72a941c8a6db31077ad41b86c2cf80 (patch)
tree1568316f4408573516da05bc8d50990d7444bc40 /src/ui.c
parentd8561cb4c33d761907fb34299706729a013d06cf (diff)
downloadmutter-11b14d327f72a941c8a6db31077ad41b86c2cf80.tar.gz
add opaque minimize/shade feature. The wireframe seemed kind of confusing
2001-08-06 Havoc Pennington <hp@pobox.com> * src/effects.c: add opaque minimize/shade feature. The wireframe seemed kind of confusing and unclear from a UI standpoint. I know, I know. The bloat begins here. Also, we don't need to grab the server during opaque min/shade, which has some nice implications. * src/ui.c: Add features to render a window with an image in it, and also wrap pixbuf_from_drawable * src/effects.c (meta_effects_draw_box_animation): modify to be smoother (at least theoretically) by syncing to current time and "dropping frames" as appropriate. * src/window.c (meta_window_shade): draw animation for shading too
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/ui.c b/src/ui.c
index c9c66b510..2e3115186 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -232,3 +232,94 @@ meta_ui_window_menu_free (MetaWindowMenu *menu)
meta_window_menu_free (menu);
}
+struct _MetaImageWindow
+{
+ GtkWidget *window;
+ GtkWidget *image;
+};
+
+MetaImageWindow*
+meta_image_window_new (void)
+{
+ MetaImageWindow *iw;
+
+ iw = g_new (MetaImageWindow, 1);
+ iw->window = gtk_window_new (GTK_WINDOW_POPUP);
+ iw->image = g_object_new (GTK_TYPE_IMAGE, NULL);
+
+ gtk_container_add (GTK_CONTAINER (iw->window), iw->image);
+
+ /* Ensure we auto-shrink to fit image */
+ gtk_window_set_resizable (GTK_WINDOW (iw->window),
+ FALSE);
+
+ return iw;
+}
+
+void
+meta_image_window_free (MetaImageWindow *iw)
+{
+ gtk_widget_destroy (iw->window);
+ g_free (iw);
+}
+
+void
+meta_image_window_set_showing (MetaImageWindow *iw,
+ gboolean showing)
+{
+ if (showing)
+ gtk_widget_show_all (iw->window);
+ else
+ gtk_widget_hide (iw->window);
+}
+
+void
+meta_image_window_set_image (MetaImageWindow *iw,
+ GdkPixbuf *pixbuf)
+{
+ gtk_image_set_from_pixbuf (GTK_IMAGE (iw->image), pixbuf);
+}
+
+void
+meta_image_window_set_position (MetaImageWindow *iw,
+ int x,
+ int y)
+{
+ gtk_widget_set_uposition (iw->window, x, y);
+}
+
+GdkPixbuf*
+meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
+ Window xwindow,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ int width,
+ int height)
+{
+ GdkDrawable *drawable;
+ GdkPixbuf *retval;
+
+ retval = NULL;
+
+ drawable = gdk_xid_table_lookup (xwindow);
+
+ if (drawable)
+ g_object_ref (G_OBJECT (drawable));
+ else
+ drawable = gdk_window_foreign_new (xwindow);
+
+ retval = gdk_pixbuf_get_from_drawable (dest,
+ drawable,
+ /* We assume root window cmap */
+ gdk_colormap_get_system (),
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height);
+
+ g_object_unref (G_OBJECT (drawable));
+
+ return retval;
+}
+