diff options
author | marcus <marcus@FreeBSD.org> | 2005-07-11 08:31:36 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2005-07-11 08:31:36 +0800 |
commit | f60133f0feae49873a33e4dcaaac0b1c71a7e420 (patch) | |
tree | c2696d89ef6ca0f98b31fdd45835cd3a12b63585 /x11-toolkits | |
parent | a7c570b2d8e47628b3019c52f741a19b010a6cd1 (diff) | |
download | freebsd-ports-gnome-f60133f0feae49873a33e4dcaaac0b1c71a7e420.tar.gz freebsd-ports-gnome-f60133f0feae49873a33e4dcaaac0b1c71a7e420.tar.zst freebsd-ports-gnome-f60133f0feae49873a33e4dcaaac0b1c71a7e420.zip |
Do not overflow G_MAXLONG with calls to gdk_property_get().
Obtained from: http://bugzilla.gnome.org/show_bug.cgi?id=309025
Diffstat (limited to 'x11-toolkits')
-rw-r--r-- | x11-toolkits/vte/Makefile | 2 | ||||
-rw-r--r-- | x11-toolkits/vte/files/patch-08_multiscreen_safe | 394 | ||||
-rw-r--r-- | x11-toolkits/vte/files/patch-src_vterdb.c | 11 |
3 files changed, 213 insertions, 194 deletions
diff --git a/x11-toolkits/vte/Makefile b/x11-toolkits/vte/Makefile index 0e86df63823b..eb2573017db0 100644 --- a/x11-toolkits/vte/Makefile +++ b/x11-toolkits/vte/Makefile @@ -7,7 +7,7 @@ PORTNAME= vte PORTVERSION= 0.11.13 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11-toolkits gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:R} diff --git a/x11-toolkits/vte/files/patch-08_multiscreen_safe b/x11-toolkits/vte/files/patch-08_multiscreen_safe index 211e48e389c9..e4cbbd5877ed 100644 --- a/x11-toolkits/vte/files/patch-08_multiscreen_safe +++ b/x11-toolkits/vte/files/patch-08_multiscreen_safe @@ -1,196 +1,3 @@ -diff -r -u src.orig/vtebg.c src/vtebg.c ---- src.orig/vtebg.c 2004-04-19 23:35:43 -0700 -+++ src/vtebg.c 2004-12-19 18:56:14 -0800 -@@ -37,7 +37,9 @@ - GList *cache; - }; - --static VteBg *singleton_bg = NULL; -+#if !GTK_CHECK_VERSION(2,2,0) -+static VteBg *singlehead_bg = NULL; -+#endif - static void vte_bg_set_root_pixmap(VteBg *bg, GdkPixmap *pixmap); - static void vte_bg_init(VteBg *bg, gpointer *klass); - static GdkPixbuf *_vte_bg_resize_pixbuf(GdkPixbuf *pixbuf, -@@ -70,7 +72,9 @@ - #include <gdk/gdkx.h> - - struct VteBgNative { -+#if GTK_CHECK_VERSION(2,2,0) - GdkDisplay *display; -+#endif - GdkWindow *window; - XID native_window; - GdkAtom atom; -@@ -81,18 +85,19 @@ - vte_bg_native_new(GdkWindow *window) - { - struct VteBgNative *pvt; -- Atom atom; -+ - pvt = g_malloc0(sizeof(struct VteBgNative)); - pvt->window = window; - pvt->native_window = gdk_x11_drawable_get_xid(window); -- pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE); -+ - #if GTK_CHECK_VERSION(2,2,0) -- atom = gdk_x11_atom_to_xatom_for_display(gdk_drawable_get_display(window), -- pvt->atom); -+ pvt->display = gdk_drawable_get_display(GDK_DRAWABLE(window)); -+ pvt->native_atom = gdk_x11_get_xatom_by_name_for_display(pvt->display, "_XROOTPMAP_ID"); -+ pvt->atom = gdk_x11_xatom_to_atom_for_display(pvt->display, pvt->native_atom); - #else -- atom = gdk_x11_atom_to_xatom(pvt->atom); -+ pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE); -+ pvt->native_atom = gdk_x11_atom_to_xatom(pvt->atom); - #endif -- pvt->native_atom = atom; - return pvt; - } - -@@ -100,7 +105,7 @@ - _vte_bg_display_sync(VteBg *bg) - { - #if GTK_CHECK_VERSION(2,2,0) -- gdk_display_sync(gdk_drawable_get_display(bg->native->window)); -+ gdk_display_sync(bg->native->display); - #else - XSync(GDK_DISPLAY(), FALSE); - #endif -@@ -136,7 +141,7 @@ - (prop_size >= sizeof(XID) && - (pixmaps != NULL))) { - #if GTK_CHECK_VERSION(2,2,0) -- pixmap = gdk_pixmap_foreign_new_for_display(gdk_drawable_get_display(bg->native->window), pixmaps[0]); -+ pixmap = gdk_pixmap_foreign_new_for_display(bg->native->display, pixmaps[0]); - #else - pixmap = gdk_pixmap_foreign_new(pixmaps[0]); - #endif -@@ -244,6 +249,7 @@ - - /** - * vte_bg_get: -+ * @screen : A #GdkScreen. - * - * Finds the address of the global #VteBg object, creating the object if - * necessary. -@@ -251,12 +257,48 @@ - * Returns: the global #VteBg object - */ - VteBg * --vte_bg_get(void) -+vte_bg_get_for_screen(gpointer screen) - { -- if (!VTE_IS_BG(singleton_bg)) { -- singleton_bg = g_object_new(VTE_TYPE_BG, NULL); -+ GdkEventMask events; -+ GdkWindow *window; -+ VteBg *bg; -+ -+#if GTK_CHECK_VERSION(2,2,0) -+ bg = g_object_get_data(G_OBJECT(screen), "vte-bg"); -+ if (G_UNLIKELY(bg == NULL)) { -+ bg = g_object_new(VTE_TYPE_BG, NULL); -+ g_object_set_data(G_OBJECT(screen), "vte-bg", bg); -+ -+ /* connect bg to screen */ -+ bg->screen = screen; -+ window = gdk_screen_get_root_window(screen); -+ bg->native = vte_bg_native_new(window); -+ bg->root_pixmap = vte_bg_root_pixmap(bg); -+ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); -+ bg->pvt->cache = NULL; -+ events = gdk_window_get_events(window); -+ events |= GDK_PROPERTY_CHANGE_MASK; -+ gdk_window_set_events(window, events); -+ gdk_window_add_filter(window, vte_bg_root_filter, bg); - } -- return singleton_bg; -+#else -+ if (G_UNLIKELY(singlehead_bg == NULL)) { -+ bg = g_object_new(VTE_TYPE_BG, NULL); -+ singlehead_bg = bg; -+ -+ window = gdk_get_default_root_window(); -+ bg->native = vte_bg_native_new(window); -+ bg->root_pixmap = vte_bg_root_pixmap(bg); -+ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); -+ bg->pvt->cache = NULL; -+ events = gdk_window_get_events(window); -+ events |= GDK_PROPERTY_CHANGE_MASK; -+ gdk_window_set_events(window, events); -+ gdk_window_add_filter(window, vte_bg_root_filter, bg); -+ } -+#endif -+ -+ return bg; - } - - struct VteBgCacheItem { -@@ -274,17 +316,6 @@ - static void - vte_bg_init(VteBg *bg, gpointer *klass) - { -- GdkWindow *window; -- GdkEventMask events; -- window = gdk_get_default_root_window(); -- bg->native = vte_bg_native_new(window); -- bg->root_pixmap = vte_bg_root_pixmap(bg); -- bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); -- bg->pvt->cache = NULL; -- events = gdk_window_get_events(window); -- events |= GDK_PROPERTY_CHANGE_MASK; -- gdk_window_set_events(window, events); -- gdk_window_add_filter(window, vte_bg_root_filter, bg); - } - - /* Generate lookup tables for desaturating an image toward a given color. The -@@ -581,10 +612,6 @@ - GdkPixbuf *pixbuf; - char *file; - -- if (bg == NULL) { -- bg = vte_bg_get(); -- } -- - if (source_type == VTE_BG_SOURCE_NONE) { - return NULL; - } -@@ -614,7 +641,11 @@ - int width, height; - /* Tell GTK+ that this foreign pixmap shares the - * root window's colormap. */ -+#if GTK_CHECK_VERSION(2,2,0) -+ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen)); -+#else - rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window()); -+#endif - if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) { - gdk_drawable_set_colormap(bg->root_pixmap, - rcolormap); -@@ -710,10 +741,6 @@ - GdkColormap *rcolormap; - char *file; - -- if (bg == NULL) { -- bg = vte_bg_get(); -- } -- - if (source_type == VTE_BG_SOURCE_NONE) { - return NULL; - } -@@ -743,7 +770,11 @@ - - /* If the pixmap doesn't have a colormap, tell GTK+ that - * it shares the root window's colormap. */ -+#if GTK_CHECK_VERSION(2,2,0) -+ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen)); -+#else - rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window()); -+#endif - if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) { - gdk_drawable_set_colormap(bg->root_pixmap, rcolormap); - } diff -r -u src.orig/vtebg.h src/vtebg.h --- src.orig/vtebg.h 2003-05-19 15:48:58 -0700 +++ src/vtebg.h 2004-12-19 18:56:14 -0800 @@ -371,3 +178,204 @@ diff -r -u src.orig/vtexft.c src/vtexft.c pixbuf, file, color, saturation, _vte_draw_get_colormap(draw, TRUE)); if (GDK_IS_PIXMAP(data->pixmap)) { +--- src/vtebg.c.orig Wed Mar 9 06:24:56 2005 ++++ src/vtebg.c Sun Jul 10 20:25:15 2005 +@@ -37,7 +37,9 @@ struct VteBgPrivate { + GList *cache; + }; + +-static VteBg *singleton_bg = NULL; ++#if !GTK_CHECK_VERSION(2,2,0) ++static VteBg *singlehead_bg = NULL; ++#endif + static void vte_bg_set_root_pixmap(VteBg *bg, GdkPixmap *pixmap); + static void vte_bg_init(VteBg *bg, gpointer *klass); + static GdkPixbuf *_vte_bg_resize_pixbuf(GdkPixbuf *pixbuf, +@@ -70,7 +72,9 @@ vte_bg_source_name(enum VteBgSourceType + #include <gdk/gdkx.h> + + struct VteBgNative { ++#if GTK_CHECK_VERSION(2,2,0) + GdkDisplay *display; ++#endif + GdkWindow *window; + XID native_window; + GdkAtom atom; +@@ -81,18 +85,19 @@ static struct VteBgNative * + vte_bg_native_new(GdkWindow *window) + { + struct VteBgNative *pvt; +- Atom atom; ++ + pvt = g_malloc0(sizeof(struct VteBgNative)); + pvt->window = window; + pvt->native_window = gdk_x11_drawable_get_xid(window); +- pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE); ++ + #if GTK_CHECK_VERSION(2,2,0) +- atom = gdk_x11_atom_to_xatom_for_display(gdk_drawable_get_display(window), +- pvt->atom); ++ pvt->display = gdk_drawable_get_display(GDK_DRAWABLE(window)); ++ pvt->native_atom = gdk_x11_get_xatom_by_name_for_display(pvt->display, "_XROOTPMAP_ID"); ++ pvt->atom = gdk_x11_xatom_to_atom_for_display(pvt->display, pvt->native_atom); + #else +- atom = gdk_x11_atom_to_xatom(pvt->atom); ++ pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE); ++ pvt->native_atom = gdk_x11_atom_to_xatom(pvt->atom); + #endif +- pvt->native_atom = atom; + return pvt; + } + +@@ -100,7 +105,7 @@ static void + _vte_bg_display_sync(VteBg *bg) + { + #if GTK_CHECK_VERSION(2,2,0) +- gdk_display_sync(gdk_drawable_get_display(bg->native->window)); ++ gdk_display_sync(bg->native->display); + #else + XSync(GDK_DISPLAY(), FALSE); + #endif +@@ -112,7 +117,7 @@ _vte_property_get_pixmaps(GdkWindow *win + XID **pixmaps) + { + return gdk_property_get(window, atom, GDK_TARGET_PIXMAP, +- 0, INT_MAX, ++ 0, INT_MAX - 3, + FALSE, + type, NULL, size, + (guchar**) pixmaps); +@@ -136,7 +141,7 @@ vte_bg_root_pixmap(VteBg *bg) + (prop_size >= sizeof(XID) && + (pixmaps != NULL))) { + #if GTK_CHECK_VERSION(2,2,0) +- pixmap = gdk_pixmap_foreign_new_for_display(gdk_drawable_get_display(bg->native->window), pixmaps[0]); ++ pixmap = gdk_pixmap_foreign_new_for_display(bg->native->display, pixmaps[0]); + #else + pixmap = gdk_pixmap_foreign_new(pixmaps[0]); + #endif +@@ -244,6 +249,7 @@ vte_bg_get_type(void) + + /** + * vte_bg_get: ++ * @screen : A #GdkScreen. + * + * Finds the address of the global #VteBg object, creating the object if + * necessary. +@@ -251,12 +257,48 @@ vte_bg_get_type(void) + * Returns: the global #VteBg object + */ + VteBg * +-vte_bg_get(void) ++vte_bg_get_for_screen(gpointer screen) + { +- if (!VTE_IS_BG(singleton_bg)) { +- singleton_bg = g_object_new(VTE_TYPE_BG, NULL); ++ GdkEventMask events; ++ GdkWindow *window; ++ VteBg *bg; ++ ++#if GTK_CHECK_VERSION(2,2,0) ++ bg = g_object_get_data(G_OBJECT(screen), "vte-bg"); ++ if (G_UNLIKELY(bg == NULL)) { ++ bg = g_object_new(VTE_TYPE_BG, NULL); ++ g_object_set_data(G_OBJECT(screen), "vte-bg", bg); ++ ++ /* connect bg to screen */ ++ bg->screen = screen; ++ window = gdk_screen_get_root_window(screen); ++ bg->native = vte_bg_native_new(window); ++ bg->root_pixmap = vte_bg_root_pixmap(bg); ++ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); ++ bg->pvt->cache = NULL; ++ events = gdk_window_get_events(window); ++ events |= GDK_PROPERTY_CHANGE_MASK; ++ gdk_window_set_events(window, events); ++ gdk_window_add_filter(window, vte_bg_root_filter, bg); + } +- return singleton_bg; ++#else ++ if (G_UNLIKELY(singlehead_bg == NULL)) { ++ bg = g_object_new(VTE_TYPE_BG, NULL); ++ singlehead_bg = bg; ++ ++ window = gdk_get_default_root_window(); ++ bg->native = vte_bg_native_new(window); ++ bg->root_pixmap = vte_bg_root_pixmap(bg); ++ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); ++ bg->pvt->cache = NULL; ++ events = gdk_window_get_events(window); ++ events |= GDK_PROPERTY_CHANGE_MASK; ++ gdk_window_set_events(window, events); ++ gdk_window_add_filter(window, vte_bg_root_filter, bg); ++ } ++#endif ++ ++ return bg; + } + + struct VteBgCacheItem { +@@ -274,17 +316,6 @@ struct VteBgCacheItem { + static void + vte_bg_init(VteBg *bg, gpointer *klass) + { +- GdkWindow *window; +- GdkEventMask events; +- window = gdk_get_default_root_window(); +- bg->native = vte_bg_native_new(window); +- bg->root_pixmap = vte_bg_root_pixmap(bg); +- bg->pvt = g_malloc0(sizeof(struct VteBgPrivate)); +- bg->pvt->cache = NULL; +- events = gdk_window_get_events(window); +- events |= GDK_PROPERTY_CHANGE_MASK; +- gdk_window_set_events(window, events); +- gdk_window_add_filter(window, vte_bg_root_filter, bg); + } + + /* Generate lookup tables for desaturating an image toward a given color. The +@@ -581,10 +612,6 @@ vte_bg_get_pixmap(VteBg *bg, + GdkPixbuf *pixbuf; + char *file; + +- if (bg == NULL) { +- bg = vte_bg_get(); +- } +- + if (source_type == VTE_BG_SOURCE_NONE) { + return NULL; + } +@@ -614,7 +641,11 @@ vte_bg_get_pixmap(VteBg *bg, + int width, height; + /* Tell GTK+ that this foreign pixmap shares the + * root window's colormap. */ ++#if GTK_CHECK_VERSION(2,2,0) ++ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen)); ++#else + rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window()); ++#endif + if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) { + gdk_drawable_set_colormap(bg->root_pixmap, + rcolormap); +@@ -710,10 +741,6 @@ vte_bg_get_pixbuf(VteBg *bg, + GdkColormap *rcolormap; + char *file; + +- if (bg == NULL) { +- bg = vte_bg_get(); +- } +- + if (source_type == VTE_BG_SOURCE_NONE) { + return NULL; + } +@@ -743,7 +770,11 @@ vte_bg_get_pixbuf(VteBg *bg, + + /* If the pixmap doesn't have a colormap, tell GTK+ that + * it shares the root window's colormap. */ ++#if GTK_CHECK_VERSION(2,2,0) ++ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen)); ++#else + rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window()); ++#endif + if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) { + gdk_drawable_set_colormap(bg->root_pixmap, rcolormap); + } diff --git a/x11-toolkits/vte/files/patch-src_vterdb.c b/x11-toolkits/vte/files/patch-src_vterdb.c new file mode 100644 index 000000000000..135f1f085885 --- /dev/null +++ b/x11-toolkits/vte/files/patch-src_vterdb.c @@ -0,0 +1,11 @@ +--- src/vterdb.c.orig Sun Jul 10 20:24:32 2005 ++++ src/vterdb.c Sun Jul 10 20:24:47 2005 +@@ -40,7 +40,7 @@ _vte_property_get_string(GdkWindow *wind + char **retval) + { + return gdk_property_get(window, atom, GDK_TARGET_STRING, +- 0, INT_MAX, ++ 0, INT_MAX - 3, + FALSE, + type, NULL, size, + (guchar**) retval); |