summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-02-19 00:58:27 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-02-19 00:58:27 +0200
commit89580e1eabaadedd322b2ab93cfd48db717edc77 (patch)
tree0fb60c2d9f09a560ed4568fe93fd84d81e783571
parent21d448772ce2e819035cd168f4434b0e79ac9884 (diff)
downloadmetacity-89580e1eabaadedd322b2ab93cfd48db717edc77.tar.gz
Revert "ui.[c/h]: remove unused function"
This reverts commit 54244b4b60016612270de42c00836ec5f90f262b.
-rw-r--r--src/include/ui.h2
-rw-r--r--src/ui/ui.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/src/include/ui.h b/src/include/ui.h
index 8f1261c7..74ed2c1e 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -178,6 +178,8 @@ int meta_ui_get_drag_threshold (MetaUI *ui);
MetaUIDirection meta_ui_get_direction (void);
+GdkPixbuf *meta_ui_get_pixbuf_from_pixmap (Pixmap pmap);
+
#include "tabpopup.h"
#include "tile-preview.h"
diff --git a/src/ui/ui.c b/src/ui/ui.c
index b2147e04..9ee7ea60 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -923,3 +923,31 @@ meta_ui_get_direction (void)
return META_UI_DIRECTION_LTR;
}
+
+GdkPixbuf *
+meta_ui_get_pixbuf_from_pixmap (Pixmap pmap)
+{
+ GdkPixmap *gpmap;
+ GdkScreen *screen;
+ GdkPixbuf *pixbuf;
+ GdkColormap *cmap;
+ int width, height, depth;
+
+ gpmap = gdk_pixmap_foreign_new (pmap);
+ screen = gdk_drawable_get_screen (gpmap);
+
+ gdk_drawable_get_size (GDK_DRAWABLE (gpmap), &width, &height);
+
+ depth = gdk_drawable_get_depth (GDK_DRAWABLE (gpmap));
+ if (depth <= 24)
+ cmap = gdk_screen_get_system_colormap (screen);
+ else
+ cmap = gdk_screen_get_rgba_colormap (screen);
+
+ pixbuf = gdk_pixbuf_get_from_drawable (NULL, gpmap, cmap, 0, 0, 0, 0,
+ width, height);
+
+ g_object_unref (gpmap);
+
+ return pixbuf;
+}