RGB data UI handler patch
- From: "Gene Z. Ragan" <gzr eazel com>
- To: gnome-components-list gnome org
- Subject: RGB data UI handler patch
- Date: Mon, 27 Mar 2000 15:31:51 -0800
Bonobo maintainers,
Listed below and added as an attachment are my modifications to the
bonobo source to allow the use of RGB data in a UI handler.
This patch requires bonobo to be linked against gdk_pixbuf. I attempted
to modify the configure script to do this, but seem to have failed. I
am still learning how to use automake and friends. If someone could
tell me the right way to do this, I would truly appreciate it.
Please take a look at the patch and let me know what you think!
Thanks!
Gene Z. Ragan
gzr@eazel.com
? bonobo.patch
Index: configure.in
===================================================================
RCS file: /cvs/gnome/bonobo/configure.in,v
retrieving revision 1.63
diff -c -r1.63 configure.in
*** configure.in 2000/02/22 06:47:43 1.63
--- configure.in 2000/03/27 21:48:07
***************
*** 84,93 ****
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
- BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui
$GNORBA_LIBNAME` $OAF_CFLAGS"
- BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui $GNORBA_LIBNAME`
$OAF_LIBS"
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
--- 84,96 ----
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
+ AM_PATH_GDK_PIXBUF(0.6.0, ,AC_MSG_ERROR([Need gdk-pixbuf!]))
+
+ BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui
gdk_pixbuf $GNORBA_LIBNAME` $OAF_CFLAGS"
+ BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui gdk_pixbuf
$GNORBA_LIBNAME` $OAF_LIBS"
+
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
Index: bonobo/Makefile.am
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/Makefile.am,v
retrieving revision 1.80
diff -c -r1.80 Makefile.am
*** bonobo/Makefile.am 2000/02/22 06:47:45 1.80
--- bonobo/Makefile.am 2000/03/27 21:48:07
***************
*** 18,27 ****
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR)
gnome_libs = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
--- 18,30 ----
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR) \
! $(GDK_PIXBUF_CFLAGS)
+
gnome_libs = \
$(GNOME_LIBDIR) \
+ $(GDK_PIXBUF_LIBS) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
***************
*** 74,80 ****
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl
$(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 #-rpath $(libdir)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
--- 77,83 ----
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl
$(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 $(gnome_libs)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
Index: bonobo/bonobo-ui-handler.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-handler.c,v
retrieving revision 1.55
diff -c -r1.55 bonobo-ui-handler.c
*** bonobo/bonobo-ui-handler.c 2000/03/02 20:05:59 1.55
--- bonobo/bonobo-ui-handler.c 2000/03/27 21:48:08
***************
*** 32,37 ****
--- 32,38 ----
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-ui-handler.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
#include "bonobo-uih-private.h"
static BonoboObjectClass *bonobo_ui_handler_parent_class;
***************
*** 1177,1188 ****
return (gpointer) dest;
}
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget
*window,
BonoboUIHandlerPixmapType
pixmap_type,
gpointer
pixmap_info)
{
! GtkWidget *pixmap;
char *name;
pixmap = NULL;
--- 1178,1208 ----
return (gpointer) dest;
}
+ static gpointer
+ bonobo_ui_handler_pixmap_rgb_copy_data (const gconstpointer src)
+ {
+ GdkPixbuf *pixbuf, *copy_pixbuf;
+
+ /* Cast src data to GdkPixbuf */
+ pixbuf = (GdkPixbuf *)src;
+
+ /* Create a copy of the data */
+ copy_pixbuf = gdk_pixbuf_new_from_art_pixbuf
(pixbuf->art_pixbuf);
+
+
+ return (gpointer) copy_pixbuf;
+ }
+
+
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget
*window,
BonoboUIHandlerPixmapType
pixmap_type,
gpointer
pixmap_info)
{
! GtkWidget *pixmap;
! GdkPixbuf *pixbuf;
! GdkPixmap *gdk_pixmap;
! GdkBitmap *gdk_bitmap;
char *name;
pixmap = NULL;
***************
*** 1214,1221 ****
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1234,1248 ----
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! /* Get pointer to GdkPixbuf */
! pixbuf = (GdkPixbuf *)pixmap_info;
!
! /* Get GdkPixmap and mask */
! gdk_pixbuf_render_pixmap_and_mask (pixbuf, &gdk_pixmap,
&gdk_bitmap, 100);
!
! /* Create GtkPixmap to return */
! pixmap = gtk_pixmap_new (gdk_pixmap, gdk_bitmap);
break;
default:
***************
*** 1251,1257 ****
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1278,1284 ----
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_free(pixmap_info);
break;
default:
***************
*** 1276,1281 ****
--- 1303,1312 ----
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
return bonobo_ui_handler_pixmap_xpm_copy_data
(pixmap_info);
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ return bonobo_ui_handler_pixmap_rgb_copy_data
(pixmap_info);
+
default:
g_warning ("Unknown pixmap type: %d\n", pixmap_type);
return NULL;
***************
*** 1411,1418 ****
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType
type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
--- 1442,1451 ----
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType
type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
! GdkPixbuf *pixbuf;
! int height, stride;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
***************
*** 1429,1441 ****
strcpy (buffer->_buffer, (char *) data);
return buffer;
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("bonobo_ui_handler_pixmap_data_to_corba:
Pixmap type (RGB[A]) not yet supported!\n");
- buffer->_length = 1;
- buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf
(1);
- return buffer;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
temp_xpm_buffer = bonobo_ui_handler_pixmap_xpm_flatten
(data, &(buffer->_length));
buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf
(buffer->_length);
--- 1462,1467 ----
***************
*** 1443,1448 ****
--- 1469,1484 ----
g_free (temp_xpm_buffer);
return buffer;
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixbuf = (GdkPixbuf *)data;
+ stride = gdk_pixbuf_get_rowstride (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ buffer->_length = height * stride;
+ buffer->_buffer =
CORBA_sequence_Bonobo_Unknown_allocbuf(buffer->_length);
+ memcpy (buffer->_buffer, gdk_pixbuf_get_pixels (pixbuf),
buffer->_length);
+ return buffer;
+
default:
g_warning ("bonobo_ui_handler_pixmap_data_to_corba:
Unknown pixmap type [%d]\n", type);
buffer->_length = 1;
***************
*** 1470,1483 ****
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("pixmap_corba_to_data: Pixmap type (RGB[A])
not yet supported!\n");
- return NULL;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
return pixmap_data;
default:
--- 1506,1520 ----
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
+ return pixmap_data;
+
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixmap_data = g_malloc(corba_pixmap_data->_length);
+ memcpy(pixmap_data, corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
return pixmap_data;
default:
Index: bonobo/bonobo-uih-menu.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-menu.c,v
retrieving revision 1.3
diff -c -r1.3 bonobo-uih-menu.c
*** bonobo/bonobo-uih-menu.c 2000/03/08 00:28:23 1.3
--- bonobo/bonobo-uih-menu.c 2000/03/27 21:48:08
***************
*** 724,729 ****
--- 724,730 ----
{
GtkWidget *menu_widget;
MenuItemInternal *rg;
+ GtkWidget *pixmap;
switch (item->type) {
case BONOBO_UI_HANDLER_MENU_ITEM:
***************
*** 734,743 ****
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type !=
BONOBO_UI_HANDLER_PIXMAP_NONE) {
! GtkWidget *pixmap;
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap =
bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget),
item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap
(GTK_PIXMAP_MENU_ITEM (menu_widget),
--- 735,743 ----
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type !=
BONOBO_UI_HANDLER_PIXMAP_NONE) {
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap =
bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget),
item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap
(GTK_PIXMAP_MENU_ITEM (menu_widget),
Index: components/application-x-gnomine/Makefile.am
===================================================================
RCS file:
/cvs/gnome/bonobo/components/application-x-gnomine/Makefile.am,v
retrieving revision 1.5
diff -c -r1.5 Makefile.am
*** components/application-x-gnomine/Makefile.am 2000/02/01
23:55:51 1.5
--- components/application-x-gnomine/Makefile.am 2000/03/27
21:48:08
***************
*** 30,36 ****
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS)
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
--- 30,37 ----
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS) \
! -lgdk_pixbuf
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
? bonobo.patch
Index: configure.in
===================================================================
RCS file: /cvs/gnome/bonobo/configure.in,v
retrieving revision 1.63
diff -c -r1.63 configure.in
*** configure.in 2000/02/22 06:47:43 1.63
--- configure.in 2000/03/27 21:48:07
***************
*** 84,93 ****
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
- BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui
$GNORBA_LIBNAME` $OAF_CFLAGS"
- BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui $GNORBA_LIBNAME`
$OAF_LIBS"
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
--- 84,96 ----
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
+ AM_PATH_GDK_PIXBUF(0.6.0, ,AC_MSG_ERROR([Need gdk-pixbuf!]))
+
+ BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui
gdk_pixbuf $GNORBA_LIBNAME` $OAF_CFLAGS"
+ BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui gdk_pixbuf
$GNORBA_LIBNAME` $OAF_LIBS"
+
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
Index: bonobo/Makefile.am
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/Makefile.am,v
retrieving revision 1.80
diff -c -r1.80 Makefile.am
*** bonobo/Makefile.am 2000/02/22 06:47:45 1.80
--- bonobo/Makefile.am 2000/03/27 21:48:07
***************
*** 18,27 ****
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR)
gnome_libs = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
--- 18,30 ----
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR) \
! $(GDK_PIXBUF_CFLAGS)
+
gnome_libs = \
$(GNOME_LIBDIR) \
+ $(GDK_PIXBUF_LIBS) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
***************
*** 74,80 ****
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl
$(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 #-rpath $(libdir)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
--- 77,83 ----
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl
$(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 $(gnome_libs)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
Index: bonobo/bonobo-ui-handler.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-handler.c,v
retrieving revision 1.55
diff -c -r1.55 bonobo-ui-handler.c
*** bonobo/bonobo-ui-handler.c 2000/03/02 20:05:59 1.55
--- bonobo/bonobo-ui-handler.c 2000/03/27 21:48:08
***************
*** 32,37 ****
--- 32,38 ----
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-ui-handler.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
#include "bonobo-uih-private.h"
static BonoboObjectClass *bonobo_ui_handler_parent_class;
***************
*** 1177,1188 ****
return (gpointer) dest;
}
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget
*window,
BonoboUIHandlerPixmapType
pixmap_type,
gpointer
pixmap_info)
{
! GtkWidget *pixmap;
char *name;
pixmap = NULL;
--- 1178,1208 ----
return (gpointer) dest;
}
+ static gpointer
+ bonobo_ui_handler_pixmap_rgb_copy_data (const gconstpointer src)
+ {
+ GdkPixbuf *pixbuf, *copy_pixbuf;
+
+ /* Cast src data to GdkPixbuf */
+ pixbuf = (GdkPixbuf *)src;
+
+ /* Create a copy of the data */
+ copy_pixbuf = gdk_pixbuf_new_from_art_pixbuf
(pixbuf->art_pixbuf);
+
+
+ return (gpointer) copy_pixbuf;
+ }
+
+
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget
*window,
BonoboUIHandlerPixmapType
pixmap_type,
gpointer
pixmap_info)
{
! GtkWidget *pixmap;
! GdkPixbuf *pixbuf;
! GdkPixmap *gdk_pixmap;
! GdkBitmap *gdk_bitmap;
char *name;
pixmap = NULL;
***************
*** 1214,1221 ****
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1234,1248 ----
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! /* Get pointer to GdkPixbuf */
! pixbuf = (GdkPixbuf *)pixmap_info;
!
! /* Get GdkPixmap and mask */
! gdk_pixbuf_render_pixmap_and_mask (pixbuf, &gdk_pixmap,
&gdk_bitmap, 100);
!
! /* Create GtkPixmap to return */
! pixmap = gtk_pixmap_new (gdk_pixmap, gdk_bitmap);
break;
default:
***************
*** 1251,1257 ****
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1278,1284 ----
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_free(pixmap_info);
break;
default:
***************
*** 1276,1281 ****
--- 1303,1312 ----
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
return bonobo_ui_handler_pixmap_xpm_copy_data
(pixmap_info);
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ return bonobo_ui_handler_pixmap_rgb_copy_data
(pixmap_info);
+
default:
g_warning ("Unknown pixmap type: %d\n", pixmap_type);
return NULL;
***************
*** 1411,1418 ****
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType
type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
--- 1442,1451 ----
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType
type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
! GdkPixbuf *pixbuf;
! int height, stride;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
***************
*** 1429,1441 ****
strcpy (buffer->_buffer, (char *) data);
return buffer;
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("bonobo_ui_handler_pixmap_data_to_corba:
Pixmap type (RGB[A]) not yet supported!\n");
- buffer->_length = 1;
- buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf
(1);
- return buffer;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
temp_xpm_buffer = bonobo_ui_handler_pixmap_xpm_flatten
(data, &(buffer->_length));
buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf
(buffer->_length);
--- 1462,1467 ----
***************
*** 1443,1448 ****
--- 1469,1484 ----
g_free (temp_xpm_buffer);
return buffer;
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixbuf = (GdkPixbuf *)data;
+ stride = gdk_pixbuf_get_rowstride (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ buffer->_length = height * stride;
+ buffer->_buffer =
CORBA_sequence_Bonobo_Unknown_allocbuf(buffer->_length);
+ memcpy (buffer->_buffer, gdk_pixbuf_get_pixels (pixbuf),
buffer->_length);
+ return buffer;
+
default:
g_warning ("bonobo_ui_handler_pixmap_data_to_corba:
Unknown pixmap type [%d]\n", type);
buffer->_length = 1;
***************
*** 1470,1483 ****
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("pixmap_corba_to_data: Pixmap type (RGB[A])
not yet supported!\n");
- return NULL;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
return pixmap_data;
default:
--- 1506,1520 ----
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
+ return pixmap_data;
+
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixmap_data = g_malloc(corba_pixmap_data->_length);
+ memcpy(pixmap_data, corba_pixmap_data->_buffer,
corba_pixmap_data->_length);
return pixmap_data;
default:
Index: bonobo/bonobo-uih-menu.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-menu.c,v
retrieving revision 1.3
diff -c -r1.3 bonobo-uih-menu.c
*** bonobo/bonobo-uih-menu.c 2000/03/08 00:28:23 1.3
--- bonobo/bonobo-uih-menu.c 2000/03/27 21:48:08
***************
*** 724,729 ****
--- 724,730 ----
{
GtkWidget *menu_widget;
MenuItemInternal *rg;
+ GtkWidget *pixmap;
switch (item->type) {
case BONOBO_UI_HANDLER_MENU_ITEM:
***************
*** 734,743 ****
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type !=
BONOBO_UI_HANDLER_PIXMAP_NONE) {
! GtkWidget *pixmap;
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap =
bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget),
item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap
(GTK_PIXMAP_MENU_ITEM (menu_widget),
--- 735,743 ----
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type !=
BONOBO_UI_HANDLER_PIXMAP_NONE) {
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap =
bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget),
item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap
(GTK_PIXMAP_MENU_ITEM (menu_widget),
Index: components/application-x-gnomine/Makefile.am
===================================================================
RCS file:
/cvs/gnome/bonobo/components/application-x-gnomine/Makefile.am,v
retrieving revision 1.5
diff -c -r1.5 Makefile.am
*** components/application-x-gnomine/Makefile.am 2000/02/01
23:55:51 1.5
--- components/application-x-gnomine/Makefile.am 2000/03/27
21:48:08
***************
*** 30,36 ****
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS)
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
--- 30,37 ----
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS) \
! -lgdk_pixbuf
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
? bonobo.patch
Index: configure.in
===================================================================
RCS file: /cvs/gnome/bonobo/configure.in,v
retrieving revision 1.63
diff -c -r1.63 configure.in
*** configure.in 2000/02/22 06:47:43 1.63
--- configure.in 2000/03/27 21:48:07
***************
*** 84,93 ****
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
- BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui $GNORBA_LIBNAME` $OAF_CFLAGS"
- BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui $GNORBA_LIBNAME` $OAF_LIBS"
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
--- 84,96 ----
AM_CONDITIONAL(OAF, test "x$enable_oaf" = "xyes")
+ AM_PATH_GDK_PIXBUF(0.6.0, ,AC_MSG_ERROR([Need gdk-pixbuf!]))
+
+ BONOBO_INCLUDEDIR="$BONOBO_INCLUDEDIR `$GNOME_CONFIG --cflags gnomeui gdk_pixbuf $GNORBA_LIBNAME` $OAF_CFLAGS"
+ BONOBO_LIBS="-lbonobo `$GNOME_CONFIG --libs gnomeui gdk_pixbuf $GNORBA_LIBNAME` $OAF_LIBS"
+
BONOBO_LIBDIR='-L${libdir}'
BONOBO_INCLUDEDIR='-I${includedir}'
AC_SUBST(BONOBO_LIBDIR)
AC_SUBST(BONOBO_INCLUDEDIR)
Index: bonobo/Makefile.am
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/Makefile.am,v
retrieving revision 1.80
diff -c -r1.80 Makefile.am
*** bonobo/Makefile.am 2000/02/22 06:47:45 1.80
--- bonobo/Makefile.am 2000/03/27 21:48:07
***************
*** 18,27 ****
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR)
gnome_libs = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
--- 18,30 ----
-I$(srcdir) -I$(top_srcdir) \
-I$(top_builddir) \
-I$(includedir) \
! $(GNOME_INCLUDEDIR) \
! $(GDK_PIXBUF_CFLAGS)
+
gnome_libs = \
$(GNOME_LIBDIR) \
+ $(GDK_PIXBUF_LIBS) \
$(GNOMEUI_LIBS) \
$(OBJECT_DIRECTORY_LIBS) \
$(INTLLIBS)
***************
*** 74,80 ****
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl $(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 #-rpath $(libdir)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
--- 77,83 ----
$(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) $(top_srcdir)/idl/Bonobo.idl -I$(top_srcdir)/idl $(idl_flags)
! libbonobo_la_LDFLAGS = -version-info 2:0:1 $(gnome_libs)
libbonobo_la_SOURCES = \
$(CORBA_SOURCE) \
Index: bonobo/bonobo-ui-handler.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-handler.c,v
retrieving revision 1.55
diff -c -r1.55 bonobo-ui-handler.c
*** bonobo/bonobo-ui-handler.c 2000/03/02 20:05:59 1.55
--- bonobo/bonobo-ui-handler.c 2000/03/27 21:48:08
***************
*** 32,37 ****
--- 32,38 ----
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-ui-handler.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
#include "bonobo-uih-private.h"
static BonoboObjectClass *bonobo_ui_handler_parent_class;
***************
*** 1177,1188 ****
return (gpointer) dest;
}
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget *window,
BonoboUIHandlerPixmapType pixmap_type,
gpointer pixmap_info)
{
! GtkWidget *pixmap;
char *name;
pixmap = NULL;
--- 1178,1208 ----
return (gpointer) dest;
}
+ static gpointer
+ bonobo_ui_handler_pixmap_rgb_copy_data (const gconstpointer src)
+ {
+ GdkPixbuf *pixbuf, *copy_pixbuf;
+
+ /* Cast src data to GdkPixbuf */
+ pixbuf = (GdkPixbuf *)src;
+
+ /* Create a copy of the data */
+ copy_pixbuf = gdk_pixbuf_new_from_art_pixbuf (pixbuf->art_pixbuf);
+
+
+ return (gpointer) copy_pixbuf;
+ }
+
+
GtkWidget *
bonobo_ui_handler_toplevel_create_pixmap (GtkWidget *window,
BonoboUIHandlerPixmapType pixmap_type,
gpointer pixmap_info)
{
! GtkWidget *pixmap;
! GdkPixbuf *pixbuf;
! GdkPixmap *gdk_pixmap;
! GdkBitmap *gdk_bitmap;
char *name;
pixmap = NULL;
***************
*** 1214,1221 ****
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1234,1248 ----
break;
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
! case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! /* Get pointer to GdkPixbuf */
! pixbuf = (GdkPixbuf *)pixmap_info;
!
! /* Get GdkPixmap and mask */
! gdk_pixbuf_render_pixmap_and_mask (pixbuf, &gdk_pixmap, &gdk_bitmap, 100);
!
! /* Create GtkPixmap to return */
! pixmap = gtk_pixmap_new (gdk_pixmap, gdk_bitmap);
break;
default:
***************
*** 1251,1257 ****
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_warning ("Unsupported pixmap type (RGB[A]_DATA)\n");
break;
default:
--- 1278,1284 ----
case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
! g_free(pixmap_info);
break;
default:
***************
*** 1276,1281 ****
--- 1303,1312 ----
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
return bonobo_ui_handler_pixmap_xpm_copy_data (pixmap_info);
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ return bonobo_ui_handler_pixmap_rgb_copy_data (pixmap_info);
+
default:
g_warning ("Unknown pixmap type: %d\n", pixmap_type);
return NULL;
***************
*** 1411,1418 ****
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
--- 1442,1451 ----
bonobo_ui_handler_pixmap_data_to_corba (BonoboUIHandlerPixmapType type, gpointer data)
{
Bonobo_UIHandler_iobuf *buffer;
! gpointer temp_xpm_buffer;
! GdkPixbuf *pixbuf;
! int height, stride;
!
buffer = Bonobo_UIHandler_iobuf__alloc ();
CORBA_sequence_set_release (buffer, TRUE);
***************
*** 1429,1441 ****
strcpy (buffer->_buffer, (char *) data);
return buffer;
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("bonobo_ui_handler_pixmap_data_to_corba: Pixmap type (RGB[A]) not yet supported!\n");
- buffer->_length = 1;
- buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf (1);
- return buffer;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
temp_xpm_buffer = bonobo_ui_handler_pixmap_xpm_flatten (data, &(buffer->_length));
buffer->_buffer = CORBA_sequence_CORBA_octet_allocbuf (buffer->_length);
--- 1462,1467 ----
***************
*** 1443,1448 ****
--- 1469,1484 ----
g_free (temp_xpm_buffer);
return buffer;
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixbuf = (GdkPixbuf *)data;
+ stride = gdk_pixbuf_get_rowstride (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ buffer->_length = height * stride;
+ buffer->_buffer = CORBA_sequence_Bonobo_Unknown_allocbuf(buffer->_length);
+ memcpy (buffer->_buffer, gdk_pixbuf_get_pixels (pixbuf), buffer->_length);
+ return buffer;
+
default:
g_warning ("bonobo_ui_handler_pixmap_data_to_corba: Unknown pixmap type [%d]\n", type);
buffer->_length = 1;
***************
*** 1470,1483 ****
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
- case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
- case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
- g_warning ("pixmap_corba_to_data: Pixmap type (RGB[A]) not yet supported!\n");
- return NULL;
-
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer, corba_pixmap_data->_length);
return pixmap_data;
default:
--- 1506,1520 ----
case BONOBO_UI_HANDLER_PIXMAP_STOCK:
return g_strdup (corba_pixmap_data->_buffer);
case BONOBO_UI_HANDLER_PIXMAP_XPM_DATA:
pixmap_data = bonobo_ui_handler_pixmap_xpm_unflatten (
corba_pixmap_data->_buffer, corba_pixmap_data->_length);
+ return pixmap_data;
+
+ case BONOBO_UI_HANDLER_PIXMAP_RGB_DATA:
+ case BONOBO_UI_HANDLER_PIXMAP_RGBA_DATA:
+ pixmap_data = g_malloc(corba_pixmap_data->_length);
+ memcpy(pixmap_data, corba_pixmap_data->_buffer, corba_pixmap_data->_length);
return pixmap_data;
default:
Index: bonobo/bonobo-uih-menu.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-menu.c,v
retrieving revision 1.3
diff -c -r1.3 bonobo-uih-menu.c
*** bonobo/bonobo-uih-menu.c 2000/03/08 00:28:23 1.3
--- bonobo/bonobo-uih-menu.c 2000/03/27 21:48:08
***************
*** 724,729 ****
--- 724,730 ----
{
GtkWidget *menu_widget;
MenuItemInternal *rg;
+ GtkWidget *pixmap;
switch (item->type) {
case BONOBO_UI_HANDLER_MENU_ITEM:
***************
*** 734,743 ****
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type != BONOBO_UI_HANDLER_PIXMAP_NONE) {
! GtkWidget *pixmap;
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap = bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget), item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_widget),
--- 735,743 ----
* a pixmap, create a GtkPixmapMenuItem.
*/
if (item->pixmap_data != NULL && item->pixmap_type != BONOBO_UI_HANDLER_PIXMAP_NONE) {
!
menu_widget = gtk_pixmap_menu_item_new ();
!
pixmap = bonobo_ui_handler_toplevel_create_pixmap (GTK_WIDGET (menu_widget), item->pixmap_type, item->pixmap_data);
if (pixmap != NULL) {
gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_widget),
Index: components/application-x-gnomine/Makefile.am
===================================================================
RCS file: /cvs/gnome/bonobo/components/application-x-gnomine/Makefile.am,v
retrieving revision 1.5
diff -c -r1.5 Makefile.am
*** components/application-x-gnomine/Makefile.am 2000/02/01 23:55:51 1.5
--- components/application-x-gnomine/Makefile.am 2000/03/27 21:48:08
***************
*** 30,36 ****
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS)
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
--- 30,37 ----
bonobo_application_x_mines_LDADD = \
$(GNOME_LIBDIR) \
$(top_builddir)/bonobo/libbonobo.la \
! $(GNOMEGNORBA_LIBS) \
! -lgdk_pixbuf
gnorbadir = $(sysconfdir)/CORBA/servers
gnorba_DATA = application-x-mines.gnorba
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]