[gnome-panel/gtk3: 2/2] Initial port to gtk3
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3: 2/2] Initial port to gtk3
- Date: Thu, 28 Oct 2010 19:29:41 +0000 (UTC)
commit 2166a6b7d91f3ffbada7412a3797da4cba0f2804
Author: Christian Persch <chpe gnome org>
Date: Thu Oct 28 12:44:10 2010 +0200
Initial port to gtk3
It Compiles!
It shows some problems at runtime.
Makefile.am | 3 +-
applets/Makefile.am | 3 +-
applets/clock/Makefile.am | 2 +-
applets/clock/calendar-window.c | 8 +-
applets/clock/clock-face.c | 86 ++---
applets/clock/clock-face.h | 2 +
applets/clock/clock-map.c | 59 +---
applets/clock/clock.c | 13 +-
applets/notification_area/Makefile.am | 2 +-
applets/notification_area/fixedtip.c | 28 +-
applets/notification_area/main.c | 8 +-
applets/notification_area/na-tray-child.c | 54 +--
applets/notification_area/na-tray-manager.c | 5 +-
applets/notification_area/na-tray.c | 29 +-
applets/notification_area/testtray.c | 6 +-
applets/wncklet/Makefile.am | 2 +-
applets/wncklet/window-list.c | 22 +-
applets/wncklet/window-menu.c | 37 +-
applets/wncklet/workspace-switcher.c | 26 +-
bonobo/libpanel-applet/Makefile.am | 2 +-
configure.ac | 42 ++-
doc/reference/panel-applet/Makefile.am | 4 +-
.../panel-applet/tmpl/panel-applet-unused.sgml | 12 +
doc/reference/panel-applet/tmpl/panel-applet.sgml | 17 +-
gnome-panel/button-widget.c | 191 +++-------
gnome-panel/drawer.c | 20 +-
gnome-panel/libpanel-util/panel-icon-chooser.c | 7 +-
gnome-panel/menu.c | 24 +-
gnome-panel/nothing.cP | 24 ++-
gnome-panel/panel-action-protocol.c | 2 +-
gnome-panel/panel-addto.c | 2 -
gnome-panel/panel-applet-frame.c | 61 ++--
gnome-panel/panel-background-monitor.c | 164 ++++++---
gnome-panel/panel-background.c | 354 ++++++++-----------
gnome-panel/panel-background.h | 24 +-
gnome-panel/panel-context-menu.c | 4 +-
gnome-panel/panel-ditem-editor.c | 10 +-
gnome-panel/panel-frame.c | 138 ++++----
gnome-panel/panel-frame.h | 1 +
gnome-panel/panel-menu-bar.c | 23 +-
gnome-panel/panel-menu-button.c | 2 +-
gnome-panel/panel-profile.c | 105 +++---
gnome-panel/panel-profile.h | 9 +-
gnome-panel/panel-properties-dialog.c | 12 +-
gnome-panel/panel-run-dialog.c | 23 +-
gnome-panel/panel-run-dialog.ui | 3 +-
gnome-panel/panel-separator.c | 49 +--
gnome-panel/panel-toplevel.c | 141 ++++----
gnome-panel/panel-types.h | 5 -
gnome-panel/panel-widget.c | 72 ++--
gnome-panel/panel.c | 14 +-
gnome-panel/xstuff.c | 27 +-
libpanel-applet/Makefile.am | 36 +-
libpanel-applet/libpanelapplet-3.0.pc.in | 11 -
...lled.pc.in => libpanelapplet-uninstalled.pc.in} | 6 +-
libpanel-applet/libpanelapplet.pc.in | 11 +
libpanel-applet/panel-applet-marshal.list | 4 -
libpanel-applet/panel-applet.c | 374 +++++++++-----------
libpanel-applet/panel-applet.h | 18 +-
libpanel-applet/test-dbus-applet.c | 23 +--
60 files changed, 1079 insertions(+), 1387 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d658dc7..162681b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,8 @@ SUBDIRS = \
po
if HAVE_BONOBO
-SUBDIRS += bonobo
+# FIXMEchpe port this
+#SUBDIRS += bonobo
endif
ACLOCAL_AMFLAGS = -I m4
diff --git a/applets/Makefile.am b/applets/Makefile.am
index e1e952d..98aad58 100644
--- a/applets/Makefile.am
+++ b/applets/Makefile.am
@@ -1,7 +1,8 @@
SUBDIRS = \
clock \
- fish \
notification_area \
wncklet
+#SUBDIRS += fish
+
-include $(top_srcdir)/git.mk
diff --git a/applets/clock/Makefile.am b/applets/clock/Makefile.am
index 52a6865..defa4f4 100644
--- a/applets/clock/Makefile.am
+++ b/applets/clock/Makefile.am
@@ -59,7 +59,7 @@ CLOCK_CPPFLAGS = \
-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE
CLOCK_LDADD = \
- ../../libpanel-applet/libpanel-applet-3.la \
+ ../../libpanel-applet/libpanel-applet-4.la \
$(CLOCK_LIBS) \
$(LIBPANEL_APPLET_LIBS) \
libsystem-timezone.la \
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 932ebda..4ed0832 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1808,7 +1808,7 @@ calendar_window_set_property (GObject *object,
}
static void
-calendar_window_destroy (GtkObject *object)
+calendar_window_dispose (GObject *object)
{
#ifdef HAVE_LIBECAL
CalendarWindow *calwin;
@@ -1848,20 +1848,18 @@ calendar_window_destroy (GtkObject *object)
calwin->priv->gconfclient = NULL;
#endif /* HAVE_LIBECAL */
- GTK_OBJECT_CLASS (calendar_window_parent_class)->destroy (object);
+ G_OBJECT_CLASS (calendar_window_parent_class)->dispose (object);
}
static void
calendar_window_class_init (CalendarWindowClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
gobject_class->constructor = calendar_window_constructor;
gobject_class->get_property = calendar_window_get_property;
gobject_class->set_property = calendar_window_set_property;
-
- gtkobject_class->destroy = calendar_window_destroy;
+ gobject_class->dispose = calendar_window_dispose;
g_type_class_add_private (klass, sizeof (CalendarWindowPrivate));
diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c
index 07bb230..7803fc4 100644
--- a/applets/clock/clock-face.c
+++ b/applets/clock/clock-face.c
@@ -22,12 +22,10 @@
static GHashTable *pixbuf_cache = NULL;
-#define CLOCK_FACE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), INTL_TYPE_CLOCK_FACE, ClockFacePrivate))
-
G_DEFINE_TYPE (ClockFace, clock_face, GTK_TYPE_WIDGET)
static void clock_face_finalize (GObject *);
-static gboolean clock_face_expose (GtkWidget *clock, GdkEventExpose *event);
+static gboolean clock_face_draw (GtkWidget *clock, cairo_t *cr);
static void clock_face_size_request (GtkWidget *clock,
GtkRequisition *requisition);
static void clock_face_size_allocate (GtkWidget *clock,
@@ -38,8 +36,6 @@ static void update_time_and_face (ClockFace *this,
static void clock_face_load_face (ClockFace *this,
gint width, gint height);
-typedef struct _ClockFacePrivate ClockFacePrivate;
-
typedef enum {
CLOCK_FACE_MORNING,
CLOCK_FACE_DAY,
@@ -70,7 +66,7 @@ clock_face_class_init (ClockFaceClass *class)
widget_class = GTK_WIDGET_CLASS (class);
/* GtkWidget signals */
- widget_class->expose_event = clock_face_expose;
+ widget_class->draw = clock_face_draw;
widget_class->size_request = clock_face_size_request;
widget_class->size_allocate = clock_face_size_allocate;
@@ -83,7 +79,9 @@ clock_face_class_init (ClockFaceClass *class)
static void
clock_face_init (ClockFace *this)
{
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (this);
+ ClockFacePrivate *priv;
+
+ priv = this->priv = G_TYPE_INSTANCE_GET_PRIVATE (this, INTL_TYPE_CLOCK_FACE, ClockFacePrivate);
priv->size = CLOCK_FACE_SMALL;
priv->timeofday = CLOCK_FACE_INVALID;
@@ -93,19 +91,19 @@ clock_face_init (ClockFace *this)
gtk_widget_set_has_window (GTK_WIDGET (this), FALSE);
}
-static void
-draw (GtkWidget *this, cairo_t *cr)
+static gboolean
+clock_face_draw (GtkWidget *this, cairo_t *cr)
{
- ClockFacePrivate *priv;
- GtkAllocation allocation;
+ ClockFacePrivate *priv = CLOCK_FACE (this)->priv;
+ int width, height;
double x, y;
double radius;
int hours, minutes, seconds;
-
/* Hand lengths as a multiple of the clock radius */
double hour_length, min_length, sec_length;
- priv = CLOCK_FACE_GET_PRIVATE (this);
+ if (GTK_WIDGET_CLASS (clock_face_parent_class)->draw)
+ GTK_WIDGET_CLASS (clock_face_parent_class)->draw (this, cr);
if (priv->size == CLOCK_FACE_LARGE) {
hour_length = 0.45;
@@ -117,31 +115,22 @@ draw (GtkWidget *this, cairo_t *cr)
sec_length = 0.8; /* not drawn currently */
}
- gtk_widget_get_allocation (this, &allocation);
-
- x = allocation.x + allocation.width / 2;
- y = allocation.y + allocation.height / 2;
- radius = MIN (allocation.width / 2,
- allocation.height / 2) - 5;
+ width = gtk_widget_get_allocated_width (this);
+ height = gtk_widget_get_allocated_width (this);
- cairo_save (cr);
- cairo_translate (cr, allocation.x, allocation.y);
+ x = width / 2;
+ y = height / 2;
+ radius = MIN (width / 2, height / 2) - 5;
/* clock back */
if (priv->face_pixbuf) {
- GdkWindow *window = gtk_widget_get_window (this);
- gdk_draw_pixbuf (GDK_DRAWABLE (window),
- NULL,
- priv->face_pixbuf,
- 0, 0,
- allocation.x,
- allocation.y,
- allocation.width,
- allocation.height,
- GDK_RGB_DITHER_NONE, 0, 0);
- }
+ cairo_save (cr);
- cairo_restore (cr);
+ gdk_cairo_set_source_pixbuf (cr, priv->face_pixbuf, 0, 0);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_paint (cr);
+ cairo_restore (cr);
+ }
/* clock hands */
hours = priv->time.tm_hour;
@@ -182,24 +171,6 @@ draw (GtkWidget *this, cairo_t *cr)
cairo_stroke (cr);
cairo_restore (cr);
}
-}
-
-static gboolean
-clock_face_expose (GtkWidget *this, GdkEventExpose *event)
-{
- cairo_t *cr;
-
- /* get a cairo_t */
- cr = gdk_cairo_create (gtk_widget_get_window (this));
-
- cairo_rectangle (cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- cairo_clip (cr);
-
- draw (this, cr);
-
- cairo_destroy (cr);
return FALSE;
}
@@ -214,7 +185,7 @@ static void
clock_face_size_request (GtkWidget *this,
GtkRequisition *requisition)
{
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (this);
+ ClockFacePrivate *priv = CLOCK_FACE (this)->priv;
if (priv->size_widget != NULL) {
GtkRequisition req;
@@ -278,7 +249,7 @@ update_time_and_face (ClockFace *this,
ClockFacePrivate *priv;
ClockFaceTimeOfDay timeofday;
- priv = CLOCK_FACE_GET_PRIVATE (this);
+ priv = this->priv;
/* update the time */
if (priv->location) {
@@ -339,7 +310,7 @@ GtkWidget *
clock_face_new (ClockFaceSize size)
{
GObject *obj = g_object_new (INTL_TYPE_CLOCK_FACE, NULL);
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (obj);
+ ClockFacePrivate *priv = CLOCK_FACE (obj)->priv;
priv->size = size;
@@ -352,7 +323,7 @@ clock_face_new_with_location (ClockFaceSize size,
GtkWidget *size_widget)
{
GObject *obj = g_object_new (INTL_TYPE_CLOCK_FACE, NULL);
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (obj);
+ ClockFacePrivate *priv = CLOCK_FACE (obj)->priv;
priv->size = size;
priv->location = g_object_ref (loc);
@@ -364,7 +335,8 @@ clock_face_new_with_location (ClockFaceSize size,
static void
clock_face_finalize (GObject *obj)
{
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (obj);
+ ClockFace *face = CLOCK_FACE (obj);
+ ClockFacePrivate *priv = face->priv;
if (priv->location) {
g_object_unref (priv->location);
@@ -400,7 +372,7 @@ remove_pixbuf_from_cache (const char *key,
static void
clock_face_load_face (ClockFace *this, gint width, gint height)
{
- ClockFacePrivate *priv = CLOCK_FACE_GET_PRIVATE (this);
+ ClockFacePrivate *priv = this->priv;
const gchar *size_string[2] = { "small", "large" };
const gchar *daytime_string[4] = { "morning", "day", "evening", "night" };
gchar *cache_name;
diff --git a/applets/clock/clock-face.h b/applets/clock/clock-face.h
index f4571bd..cd620a6 100644
--- a/applets/clock/clock-face.h
+++ b/applets/clock/clock-face.h
@@ -27,6 +27,7 @@ G_BEGIN_DECLS
#define CLOCK_FACE_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), INTL_TYPE_CLOCK_FACE, ClockFaceClass))
typedef struct _ClockFace ClockFace;
+typedef struct _ClockFacePrivate ClockFacePrivate;
typedef struct _ClockFaceClass ClockFaceClass;
struct _ClockFace
@@ -34,6 +35,7 @@ struct _ClockFace
GtkWidget parent;
/* < private > */
+ ClockFacePrivate *priv;
};
struct _ClockFaceClass
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 5a6e037..1d8c5a1 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -60,8 +60,8 @@ static void clock_map_size_request (GtkWidget *this,
GtkRequisition *requisition);
static void clock_map_size_allocate (GtkWidget *this,
GtkAllocation *allocation);
-static gboolean clock_map_expose (GtkWidget *this,
- GdkEventExpose *expose);
+static gboolean clock_map_draw (GtkWidget *this,
+ cairo_t *cr);
static void clock_map_place_locations (ClockMap *this);
static void clock_map_render_shadow (ClockMap *this);
@@ -90,7 +90,7 @@ clock_map_class_init (ClockMapClass *this_class)
/* GtkWidget signals */
widget_class->size_request = clock_map_size_request;
widget_class->size_allocate = clock_map_size_allocate;
- widget_class->expose_event = clock_map_expose;
+ widget_class->draw = clock_map_draw;
g_type_class_add_private (this_class, sizeof (ClockMapPrivate));
@@ -217,62 +217,33 @@ clock_map_refresh (ClockMap *this)
}
static gboolean
-clock_map_expose (GtkWidget *this, GdkEventExpose *event)
+clock_map_draw (GtkWidget *this, cairo_t *cr)
{
ClockMapPrivate *priv = PRIVATE (this);
- GdkWindow *window;
GtkStyle *style;
- GtkAllocation allocation;
- GdkRectangle region;
- cairo_t *cr;
+ int width, height;
- window = gtk_widget_get_window (this);
style = gtk_widget_get_style (this);
- gtk_widget_get_allocation (this, &allocation);
+ width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf);
+ height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf);
+
+ // FIXMEchpe fix this!
if (!priv->shadow_map_pixbuf) {
- g_warning ("Needed to refresh the map in expose event.");
+ g_warning ("Needed to refresh the map in draw event.");
clock_map_refresh (CLOCK_MAP (this));
}
- cr = gdk_cairo_create (window);
-
- region.x = allocation.x;
- region.y = allocation.y;
- region.width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf);
- region.height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf);
-
- gdk_rectangle_intersect (®ion, &(event->area), ®ion);
- gdk_draw_pixbuf (window,
- style->black_gc,
- priv->shadow_map_pixbuf,
- region.x - allocation.x,
- region.y - allocation.y,
- region.x,
- region.y,
- region.width,
- region.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
+ gdk_cairo_set_source_pixbuf (cr, priv->shadow_map_pixbuf, 0, 0);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_paint (cr);
/* draw a simple outline */
- cairo_rectangle (
- cr,
- allocation.x + 0.5, allocation.y + 0.5,
- gdk_pixbuf_get_width (priv->shadow_map_pixbuf) - 1,
- gdk_pixbuf_get_height (priv->shadow_map_pixbuf) - 1);
-
- cairo_set_source_rgb (
- cr,
- style->mid [GTK_STATE_ACTIVE].red / 65535.0,
- style->mid [GTK_STATE_ACTIVE].green / 65535.0,
- style->mid [GTK_STATE_ACTIVE].blue / 65535.0);
-
+ cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
+ gdk_cairo_set_source_color (cr, &style->mid [GTK_STATE_ACTIVE]);
cairo_set_line_width (cr, 1.0);
cairo_stroke (cr);
- cairo_destroy (cr);
-
return FALSE;
}
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index c4f4a02..09efa38 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -804,7 +804,7 @@ close_on_escape (GtkWidget *widget,
GdkEventKey *event,
GtkToggleButton *toggle_button)
{
- if (event->keyval == GDK_Escape) {
+ if (event->keyval == GDK_KEY_Escape) {
gtk_toggle_button_set_active (toggle_button, FALSE);
return TRUE;
}
@@ -3385,6 +3385,7 @@ fill_prefs_window (ClockData *cd)
GtkCellRenderer *renderer;
GtkTreeViewColumn *col;
GtkListStore *store;
+ GtkTreeIter iter;
int i;
/* Set the 12 hour / 24 hour widget */
@@ -3451,8 +3452,9 @@ fill_prefs_window (ClockData *cd)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, "text", 0, NULL);
for (i = 0; temperatures[i] != -1; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
- gweather_prefs_get_temp_display_name (temperatures[i]));
+ gtk_list_store_insert_with_values (store, &iter, -1,
+ 0, gweather_prefs_get_temp_display_name (temperatures[i]),
+ -1);
update_temperature_combo (cd);
g_signal_connect (widget, "changed",
@@ -3467,8 +3469,9 @@ fill_prefs_window (ClockData *cd)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, "text", 0, NULL);
for (i = 0; speeds[i] != -1; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
- gweather_prefs_get_speed_display_name (speeds[i]));
+ gtk_list_store_insert_with_values (store, &iter, -1,
+ 0, gweather_prefs_get_speed_display_name (speeds[i]),
+ -1);
update_speed_combo (cd);
g_signal_connect (widget, "changed",
diff --git a/applets/notification_area/Makefile.am b/applets/notification_area/Makefile.am
index c70ce9a..d933e41 100644
--- a/applets/notification_area/Makefile.am
+++ b/applets/notification_area/Makefile.am
@@ -29,7 +29,7 @@ libtray_la_SOURCES = \
NOTIFICATION_AREA_SOURCES = main.c
NOTIFICATION_AREA_LDADD = \
- ../../libpanel-applet/libpanel-applet-3.la \
+ ../../libpanel-applet/libpanel-applet-4.la \
$(X_LIBS) \
$(NOTIFICATION_AREA_LIBS) \
$(LIBPANEL_APPLET_LIBS) \
diff --git a/applets/notification_area/fixedtip.c b/applets/notification_area/fixedtip.c
index ff947df..06c40d9 100644
--- a/applets/notification_area/fixedtip.c
+++ b/applets/notification_area/fixedtip.c
@@ -52,17 +52,18 @@ button_press_handler (GtkWidget *fixedtip,
}
static gboolean
-expose_handler (GtkWidget *fixedtip)
+na_fixed_tip_draw (GtkWidget *widget, cairo_t *cr)
{
- GtkRequisition req;
+ int width, height;
- gtk_widget_size_request (fixedtip, &req);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
- gtk_paint_flat_box (gtk_widget_get_style (fixedtip),
- gtk_widget_get_window (fixedtip),
+ gtk_paint_flat_box (gtk_widget_get_style (widget),
+ cr,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, fixedtip, "tooltip",
- 0, 0, req.width, req.height);
+ widget, "tooltip",
+ 0, 0, width, height);
return FALSE;
}
@@ -70,6 +71,10 @@ expose_handler (GtkWidget *fixedtip)
static void
na_fixed_tip_class_init (NaFixedTipClass *class)
{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+ widget_class->draw = na_fixed_tip_draw;
+
fixedtip_signals[CLICKED] =
g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (class),
@@ -106,11 +111,8 @@ na_fixed_tip_init (NaFixedTip *fixedtip)
gtk_container_add (GTK_CONTAINER (fixedtip), label);
fixedtip->priv->label = label;
- g_signal_connect (fixedtip, "expose_event",
- G_CALLBACK (expose_handler), NULL);
-
gtk_widget_add_events (GTK_WIDGET (fixedtip), GDK_BUTTON_PRESS_MASK);
-
+
g_signal_connect (fixedtip, "button_press_event",
G_CALLBACK (button_press_handler), NULL);
@@ -138,8 +140,8 @@ na_fixed_tip_position (NaFixedTip *fixedtip)
gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
gdk_window_get_origin (parent_window, &root_x, &root_y);
- gdk_drawable_get_size (GDK_DRAWABLE (parent_window),
- &parent_width, &parent_height);
+ parent_width = gdk_window_get_width (parent_window);
+ parent_height = gdk_window_get_height (parent_window);
screen_width = gdk_screen_get_width (screen);
screen_height = gdk_screen_get_height (screen);
diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c
index 5f44075..2465a21 100644
--- a/applets/notification_area/main.c
+++ b/applets/notification_area/main.c
@@ -177,11 +177,9 @@ static const GtkActionEntry menu_actions [] = {
};
static void
-applet_change_background (PanelApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap,
- AppletData *data)
+applet_change_background (PanelApplet *applet,
+ cairo_pattern_t *pattern,
+ AppletData *data)
{
na_tray_force_redraw (data->tray);
}
diff --git a/applets/notification_area/na-tray-child.c b/applets/notification_area/na-tray-child.c
index 79bca26..8625c9e 100644
--- a/applets/notification_area/na-tray-child.c
+++ b/applets/notification_area/na-tray-child.c
@@ -60,11 +60,12 @@ na_tray_child_realize (GtkWidget *widget)
child->parent_relative_bg = FALSE;
}
- else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (window))))
+ else if (visual == gdk_window_get_visual (gdk_window_get_parent (window)))
{
/* Otherwise, if the visual matches the visual of the parent window, we
* can use a parent-relative background and fake transparency. */
- gdk_window_set_back_pixmap (window, NULL, TRUE);
+ // FIXMEchpe
+ gdk_window_set_background_pattern (window, NULL);
child->parent_relative_bg = TRUE;
}
@@ -176,28 +177,27 @@ na_tray_child_size_allocate (GtkWidget *widget,
* expose handler draws with real or fake transparency.
*/
static gboolean
-na_tray_child_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+na_tray_child_draw (GtkWidget *widget,
+ cairo_t *cr)
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
- GdkWindow *window = gtk_widget_get_window (widget);
if (na_tray_child_has_alpha (child))
{
/* Clear to transparent */
- cairo_t *cr = gdk_cairo_create (window);
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_region (cr, event->region);
cairo_fill (cr);
- cairo_destroy (cr);
}
else if (child->parent_relative_bg)
{
/* Clear to parent-relative pixmap */
+ // FIXMEchpe
+ #if 0
gdk_window_clear_area (window,
event->area.x, event->area.y,
event->area.width, event->area.height);
+ #endif
}
return FALSE;
@@ -221,7 +221,7 @@ na_tray_child_class_init (NaTrayChildClass *klass)
widget_class->style_set = na_tray_child_style_set;
widget_class->realize = na_tray_child_realize;
widget_class->size_allocate = na_tray_child_size_allocate;
- widget_class->expose_event = na_tray_child_expose_event;
+ widget_class->draw = na_tray_child_draw;
}
GtkWidget *
@@ -233,8 +233,6 @@ na_tray_child_new (GdkScreen *screen,
NaTrayChild *child;
GdkVisual *visual;
gboolean visual_has_alpha;
- GdkColormap *colormap;
- gboolean new_colormap;
int red_prec, green_prec, blue_prec, depth;
int result;
@@ -250,9 +248,8 @@ na_tray_child_new (GdkScreen *screen,
gdk_error_trap_push ();
result = XGetWindowAttributes (xdisplay, icon_window,
&window_attributes);
- gdk_error_trap_pop ();
-
- if (!result) /* Window already gone */
+ gdk_flush ();
+ if (gdk_error_trap_pop () || result != Success)
return NULL;
visual = gdk_x11_screen_lookup_visual (screen,
@@ -260,24 +257,10 @@ na_tray_child_new (GdkScreen *screen,
if (!visual) /* Icon window is on another screen? */
return NULL;
- new_colormap = FALSE;
-
- if (visual == gdk_screen_get_rgb_visual (screen))
- colormap = gdk_screen_get_rgb_colormap (screen);
- else if (visual == gdk_screen_get_rgba_visual (screen))
- colormap = gdk_screen_get_rgba_colormap (screen);
- else if (visual == gdk_screen_get_system_visual (screen))
- colormap = gdk_screen_get_system_colormap (screen);
- else
- {
- colormap = gdk_colormap_new (visual, FALSE);
- new_colormap = TRUE;
- }
-
child = g_object_new (NA_TYPE_TRAY_CHILD, NULL);
child->icon_window = icon_window;
- gtk_widget_set_colormap (GTK_WIDGET (child), colormap);
+ gtk_widget_set_visual (GTK_WIDGET (child), visual);
/* We have alpha if the visual has something other than red, green,
* and blue */
@@ -292,9 +275,6 @@ na_tray_child_new (GdkScreen *screen,
child->composited = child->has_alpha;
- if (new_colormap)
- g_object_unref (colormap);
-
return GTK_WIDGET (child);
}
@@ -430,15 +410,11 @@ na_tray_child_force_redraw (NaTrayChild *child)
xev.xexpose.count = 0;
gdk_error_trap_push ();
- XSendEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
+ XSendEvent (xdisplay,
xev.xexpose.window,
False, ExposureMask,
&xev);
- /* We have to sync to reliably catch errors from the XSendEvent(),
- * since that is asynchronous.
- */
- XSync (xdisplay, False);
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
#else
/* Hiding and showing is the safe way to do it, but can result in more
* flickering.
@@ -482,7 +458,7 @@ _get_wmclass (Display *xdisplay,
gdk_error_trap_push ();
XGetClassHint (xdisplay, xwindow, &ch);
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
if (res_class)
*res_class = NULL;
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index 8a1adf1..e7abe3e 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -647,10 +647,7 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
* be embedded. In almost all cases, this will be the same as the visual
* of the screen.
*/
- GdkColormap *colormap;
-
- colormap = gdk_screen_get_default_colormap (manager->screen);
- xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap));
+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (manager->screen));
}
data[0] = XVisualIDFromVisual (xvisual);
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index 45cba59..1299f9f 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -528,10 +528,10 @@ update_size_and_orientation (NaTray *tray)
* gdk_window_set_composited(). We need to paint these children ourselves.
*/
static void
-na_tray_expose_icon (GtkWidget *widget,
- gpointer data)
+na_tray_draw_icon (GtkWidget *widget,
+ gpointer data)
{
- cairo_t *cr = data;
+ cairo_t *cr = (cairo_t *) data;
if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
{
@@ -539,26 +539,23 @@ na_tray_expose_icon (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
- gdk_cairo_set_source_pixmap (cr,
+ cairo_save (cr);
+ gdk_cairo_set_source_window (cr,
gtk_widget_get_window (widget),
allocation.x,
allocation.y);
+ cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height);
+ cairo_clip (cr);
cairo_paint (cr);
+ cairo_restore (cr);
}
}
static void
-na_tray_expose_box (GtkWidget *box,
- GdkEventExpose *event)
+na_tray_draw_box (GtkWidget *box,
+ cairo_t *cr)
{
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (box));
-
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
- gtk_container_foreach (GTK_CONTAINER (box), na_tray_expose_icon, cr);
-
- cairo_destroy (cr);
+ gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
}
static void
@@ -576,8 +573,8 @@ na_tray_init (NaTray *tray)
gtk_widget_show (priv->frame);
priv->box = g_object_new (na_box_get_type (), NULL);
- g_signal_connect (priv->box, "expose-event",
- G_CALLBACK (na_tray_expose_box), tray);
+ g_signal_connect (priv->box, "draw",
+ G_CALLBACK (na_tray_draw_box), NULL);
gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING);
gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
gtk_widget_show (priv->box);
diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c
index 4a4f56b..7efa0d7 100644
--- a/applets/notification_area/testtray.c
+++ b/applets/notification_area/testtray.c
@@ -162,9 +162,9 @@ create_tray_on_screen (GdkScreen *screen,
label = gtk_label_new_with_mnemonic ("_Orientation:");
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "Horizontal");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "Vertical");
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Horizontal");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Vertical");
g_signal_connect (combo, "changed",
G_CALLBACK (orientation_changed_cb), data);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am
index 7ade04c..8311782 100644
--- a/applets/wncklet/Makefile.am
+++ b/applets/wncklet/Makefile.am
@@ -26,7 +26,7 @@ WNCKLET_SOURCES = \
showdesktop.h
WNCKLET_LDADD = \
- ../../libpanel-applet/libpanel-applet-3.la \
+ ../../libpanel-applet/libpanel-applet-4.la \
$(WNCKLET_LIBS) \
$(LIBPANEL_APPLET_LIBS)
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index a93cf79..ccaadb3 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -132,23 +132,13 @@ applet_change_orient (PanelApplet *applet,
}
static void
-applet_change_background (PanelApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap,
- TasklistData *tasklist)
+applet_change_background (PanelApplet *applet,
+ cairo_pattern_t *pattern,
+ TasklistData *tasklist)
{
- switch (type) {
- case PANEL_NO_BACKGROUND:
- wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->tasklist),
- GTK_RELIEF_NORMAL);
- break;
- case PANEL_COLOR_BACKGROUND:
- case PANEL_PIXMAP_BACKGROUND:
- wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->tasklist),
- GTK_RELIEF_NONE);
- break;
- }
+ wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->tasklist),
+ pattern != NULL ? GTK_RELIEF_NONE
+ : GTK_RELIEF_NORMAL);
}
static void
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index 472cfb9..0549d50 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -113,20 +113,21 @@ window_menu_destroy (GtkWidget *widget,
}
static gboolean
-window_menu_on_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
+window_menu_on_draw (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
- WindowMenu *window_menu = data;
+ WindowMenu *window_menu = data;
if (gtk_widget_has_focus (window_menu->applet))
gtk_paint_focus (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
+ cr,
gtk_widget_get_state (widget),
- NULL,
widget,
"menu-applet",
- 0, 0, -1, -1);
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
return FALSE;
}
@@ -193,12 +194,12 @@ window_menu_key_press_event (GtkWidget *widget,
WnckSelector *selector;
switch (event->keyval) {
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- case GDK_3270_Enter:
- case GDK_Return:
- case GDK_space:
- case GDK_KP_Space:
+ case GDK_KEY_KP_Enter:
+ case GDK_KEY_ISO_Enter:
+ case GDK_KEY_3270_Enter:
+ case GDK_KEY_Return:
+ case GDK_KEY_space:
+ case GDK_KEY_KP_Space:
selector = WNCK_SELECTOR(window_menu->selector);
/*
* We need to call _gtk_menu_shell_activate() here as is done in
@@ -208,10 +209,10 @@ window_menu_key_press_event (GtkWidget *widget,
* As that function is private its code is replicated here.
*/
menu_shell = GTK_MENU_SHELL (selector);
- if (!menu_shell->active) {
+ if (!menu_shell->GSEAL(active)) {
gtk_grab_add (GTK_WIDGET (menu_shell));
- menu_shell->have_grab = TRUE;
- menu_shell->active = TRUE;
+ menu_shell->GSEAL(have_grab) = TRUE;
+ menu_shell->GSEAL(active) = TRUE;
}
gtk_menu_shell_select_first (menu_shell, FALSE);
return TRUE;
@@ -280,8 +281,8 @@ window_menu_applet_fill (PanelApplet *applet)
G_CALLBACK (gtk_widget_queue_draw), window_menu);
g_signal_connect_after (G_OBJECT (window_menu->applet), "focus-out-event",
G_CALLBACK (gtk_widget_queue_draw), window_menu);
- g_signal_connect_after (G_OBJECT (window_menu->selector), "expose-event",
- G_CALLBACK (window_menu_on_expose), window_menu);
+ g_signal_connect_after (G_OBJECT (window_menu->selector), "draw",
+ G_CALLBACK (window_menu_on_draw), window_menu);
g_signal_connect (G_OBJECT (window_menu->selector), "button_press_event",
G_CALLBACK (filter_button_press), window_menu);
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 5b1735d..5c791c8 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -213,25 +213,11 @@ applet_change_orient (PanelApplet *applet,
static void
applet_change_background (PanelApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap,
+ cairo_pattern_t *pattern,
PagerData *pager)
{
- switch (type) {
- case PANEL_NO_BACKGROUND:
- wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager),
- GTK_SHADOW_IN);
- break;
- case PANEL_COLOR_BACKGROUND:
- wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager),
- GTK_SHADOW_NONE);
- break;
- case PANEL_PIXMAP_BACKGROUND:
- wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager),
- GTK_SHADOW_NONE);
- break;
- }
+ wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager),
+ pattern != NULL ? GTK_SHADOW_NONE : GTK_SHADOW_IN);
}
static gboolean
@@ -731,10 +717,12 @@ static void
num_workspaces_value_changed (GtkSpinButton *button,
PagerData *pager)
{
+#if 0
/* Slow down a bit after the first change, since it's moving really to
* fast. See bug #336731 for background.
* FIXME: remove this if bug 410520 gets fixed. */
button->timer_step = 0.2;
+#endif
wnck_screen_change_workspace_count (pager->screen,
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pager->num_workspaces_spin)));
@@ -833,8 +821,8 @@ close_dialog (GtkWidget *button,
*/
col = gtk_tree_view_get_column(GTK_TREE_VIEW (pager->workspaces_tree),0);
- if (col->editable_widget != NULL && GTK_IS_CELL_EDITABLE (col->editable_widget))
- gtk_cell_editable_editing_done(col->editable_widget);
+ if (col->GSEAL (editable_widget) != NULL && GTK_IS_CELL_EDITABLE (col->GSEAL (editable_widget)))
+ gtk_cell_editable_editing_done(col->GSEAL (editable_widget));
gtk_widget_destroy (pager->properties_dialog);
}
diff --git a/bonobo/libpanel-applet/Makefile.am b/bonobo/libpanel-applet/Makefile.am
index 463d2eb..3ec9090 100644
--- a/bonobo/libpanel-applet/Makefile.am
+++ b/bonobo/libpanel-applet/Makefile.am
@@ -65,7 +65,7 @@ panel-applet-marshal.c: panel-applet-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN)echo "#include \"panel-applet-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=panel_applet_marshal >> $@
-panel_applet_enum_headers = $(top_srcdir)/libpanel-applet/panel-applet.h
+panel_applet_enum_headers = panel-applet.h
panel-applet-enums.c: @REBUILD@ $(panel_applet_enum_headers)
$(AM_V_GEN)glib-mkenums \
diff --git a/configure.ac b/configure.ac
index 3493225..9907056 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([gnome-panel], [2.32.1],
+AC_INIT([gnome-panel], [2.91.0],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-panel])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 tar-ustar -Wno-portability])
@@ -15,6 +15,9 @@ GNOME_COMMON_INIT
# change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
+m4_define([libpanel_applet_api_version],[4.0])
+AC_SUBST([LIBPANEL_APPLET_API_VERSION],[libpanel_applet_api_version])
+
LIB_PANEL_APPLET_LT_VERSION=0:5:0
AC_SUBST(LIB_PANEL_APPLET_LT_VERSION)
@@ -57,7 +60,7 @@ fi
AC_CHECK_HEADERS(crt_externs.h)
AC_CHECK_FUNCS(_NSGetEnviron)
-LIBGNOME_DESKTOP_REQUIRED=2.24.0
+LIBGNOME_DESKTOP_REQUIRED=2.91.0
GDK_PIXBUF_REQUIRED=2.7.1
PANGO_REQUIRED=1.15.4
GLIB_REQUIRED=2.25.12
@@ -66,22 +69,22 @@ GTK_REQUIRED=2.91.2
LIBWNCK_REQUIRED=2.91.0
GCONF_REQUIRED=2.6.1
LIBGNOME_MENU_REQUIRED=2.27.92
-LIBECAL_REQUIRED=1.6.0
-LIBEDATASERVER_REQUIRED=1.2.0
-LIBEDATASERVERUI_REQUIRED=1.2.0
+LIBECAL_REQUIRED=2.91.2
+LIBEDATASERVER_REQUIRED=2.91.2
+LIBEDATASERVERUI_REQUIRED=2.91.2
CAIRO_REQUIRED=1.0.0
-GWEATHER_REQUIRED=2.27.90
+GWEATHER_REQUIRED=2.91.0
DBUS_GLIB_REQUIRED=0.80
dnl pkg-config dependency checks
PKG_CHECK_MODULES(EGG_SMCLIENT, ice sm gtk+-3.0)
-PKG_CHECK_MODULES(PANEL, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED libcanberra-gtk dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
+PKG_CHECK_MODULES(PANEL, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED cairo-xlib glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED libcanberra-gtk3 dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
AC_SUBST(PANEL_CFLAGS)
AC_SUBST(PANEL_LIBS)
-PKG_CHECK_MODULES(LIBPANEL_APPLET, gtk+-3.0 >= $GTK_REQUIRED gconf-2.0 >= $GCONF_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED)
+PKG_CHECK_MODULES(LIBPANEL_APPLET, gtk+-3.0 >= $GTK_REQUIRED cairo-xlib cairo-gobject gconf-2.0 >= $GCONF_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED)
AC_SUBST(LIBPANEL_APPLET_CFLAGS)
AC_SUBST(LIBPANEL_APPLET_LIBS)
@@ -107,15 +110,15 @@ AC_ARG_ENABLE(eds,
LIBECAL_REQUIREMENT=
HAVE_EDS=no
if test "x$enable_eds" = "xyes"; then
- LIBECAL_REQUIREMENT="libecal-1.2 >= $LIBECAL_REQUIRED libedataserver-1.2 >= $LIBEDATASERVER_REQUIRED libedataserverui-1.2 >= $LIBEDATASERVERUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED"
- CLOCK_EDS_ICONDIR=`$PKG_CONFIG --variable=datadir evolution-data-server-1.2`/pixmaps/evolution-data-server
+ LIBECAL_REQUIREMENT="libecal-3.0 >= $LIBECAL_REQUIRED libedataserver-3.0 >= $LIBEDATASERVER_REQUIRED libedataserverui-3.0 >= $LIBEDATASERVERUI_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED"
+ CLOCK_EDS_ICONDIR=`$PKG_CONFIG --variable=datadir evolution-data-server-3.0`/pixmaps/evolution-data-server
else
if test "x$enable_eds" != "xno"; then
AC_MSG_CHECKING(for evolution-data-server)
- if $PKG_CONFIG --exists libecal-1.2 libedataserverui-1.2 evolution-data-server-1.2; then
+ if $PKG_CONFIG --exists libecal-3.0 libedataserverui-3.0 evolution-data-server-3.0; then
AC_MSG_RESULT(yes)
- LIBECAL_REQUIREMENT="libecal-1.2 >= $LIBECAL_REQUIRED libedataserver-1.2 >= $LIBEDATASERVER_REQUIRED libedataserverui-1.2 >= $LIBEDATASERVERUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED"
- CLOCK_EDS_ICONDIR=`$PKG_CONFIG --variable=datadir evolution-data-server-1.2`/pixmaps/evolution-data-server
+ LIBECAL_REQUIREMENT="libecal-3.0 >= $LIBECAL_REQUIRED libedataserver-3.0 >= $LIBEDATASERVER_REQUIRED libedataserverui-3.0 >= $LIBEDATASERVERUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED"
+ CLOCK_EDS_ICONDIR=`$PKG_CONFIG --variable=datadir evolution-data-server-3.0`/pixmaps/evolution-data-server
HAVE_EDS=yes
else
AC_MSG_RESULT(no)
@@ -124,7 +127,7 @@ else
fi
if test -n "$LIBECAL_REQUIREMENT"; then
AC_DEFINE([HAVE_LIBECAL], 1,
- [Defined when evolution-data-server libecal-1.2 and libedataserverui-1.2 are detected])
+ [Defined when evolution-data-server libecal-3.0 and libedataserverui-3.0 are detected])
fi
AM_CONDITIONAL(HAVE_LIBECAL, test -n "$LIBECAL_REQUIREMENT")
AC_SUBST(CLOCK_EDS_ICONDIR)
@@ -133,7 +136,7 @@ PKG_CHECK_MODULES(TZ, gio-2.0 >= $GLIB_REQUIRED)
AC_SUBST(TZ_CFLAGS)
AC_SUBST(TZ_LIBS)
-PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED $LIBECAL_REQUIREMENT librsvg-2.0 dbus-glib-1 gweather >= $GWEATHER_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED)
+PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED $LIBECAL_REQUIREMENT librsvg-2.0 dbus-glib-1 gweather-3.0 >= $GWEATHER_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED)
AC_SUBST(CLOCK_CFLAGS)
AC_SUBST(CLOCK_LIBS)
@@ -348,7 +351,7 @@ if test "x$enable_rebuilds" = "xyes" && \
fi
AC_SUBST(REBUILD)
-AC_OUTPUT([
+AC_CONFIG_FILES([
Makefile
icons/Makefile
icons/16x16/Makefile
@@ -362,8 +365,6 @@ gnome-panel/libegg/Makefile
gnome-panel/libpanel-applet-private/Makefile
gnome-panel/libpanel-util/Makefile
gnome-panel/gnome-panel.desktop.in
-libpanel-applet/libpanelapplet-3.0.pc
-libpanel-applet/libpanelapplet-3.0-uninstalled.pc
libpanel-applet/Makefile
po/Makefile.in
applets/Makefile
@@ -387,6 +388,11 @@ bonobo/libpanel-applet/Makefile
bonobo/panel-module/Makefile
])
+AC_CONFIG_FILES(libpanel-applet/libpanelapplet-[]libpanel_applet_api_version[].pc:libpanel-applet/libpanelapplet.pc.in)
+AC_CONFIG_FILES(libpanel-applet/libpanelapplet-[]libpanel_applet_api_version[]-uninstalled.pc:libpanel-applet/libpanelapplet-uninstalled.pc.in)
+
+AC_OUTPUT
+
if echo foo | xgettext --from-code=UTF-8 -LC -o - - 2>/dev/null ; then
:;
else
diff --git a/doc/reference/panel-applet/Makefile.am b/doc/reference/panel-applet/Makefile.am
index 1707afe..26eb671 100644
--- a/doc/reference/panel-applet/Makefile.am
+++ b/doc/reference/panel-applet/Makefile.am
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = 1.6
# The name of the module, e.g. 'glib'.
DOC_MODULE=panel-applet
-DOC_MODULE_VERSION=3.0
+DOC_MODULE_VERSION=4.0
# The top-level SGML file. Change it if you want.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
@@ -56,7 +56,7 @@ GTKDOC_CFLAGS = \
GTKDOC_LIBS = \
$(LDFLAGS) \
$(PANEL_LIBS) \
- ../../../libpanel-applet/libpanel-applet-3.la
+ ../../../libpanel-applet/libpanel-applet-4.la
include $(top_srcdir)/gtk-doc.make
diff --git a/doc/reference/panel-applet/tmpl/panel-applet-unused.sgml b/doc/reference/panel-applet/tmpl/panel-applet-unused.sgml
index 621e157..5d08c73 100644
--- a/doc/reference/panel-applet/tmpl/panel-applet-unused.sgml
+++ b/doc/reference/panel-applet/tmpl/panel-applet-unused.sgml
@@ -46,6 +46,18 @@ The applet is orientated up (i.e. the panel is at the bottom of the screen).
</para>
+<!-- ##### ENUM PanelAppletBackgroundType ##### -->
+<para>
+The #PanelAppletBackgroundType enumerated type specifies the type of
+background of a panel.
+</para>
+
+ PANEL_NO_BACKGROUND: The panel has no background, the default is used.
+ PANEL_COLOR_BACKGROUND: The panel has a color, i.e rgb value,
+background.
+ PANEL_PIXMAP_BACKGROUND: The panel has either an image background
+or is translucent.
+
<!-- ##### FUNCTION panel_applet_factory_main_closure ##### -->
<para>
A generic 'main' routine for applets. This should not normally be
diff --git a/doc/reference/panel-applet/tmpl/panel-applet.sgml b/doc/reference/panel-applet/tmpl/panel-applet.sgml
index cb86404..5097a88 100644
--- a/doc/reference/panel-applet/tmpl/panel-applet.sgml
+++ b/doc/reference/panel-applet/tmpl/panel-applet.sgml
@@ -41,8 +41,6 @@ determine which, if any, of @color and @pimxap is valid.
@panelapplet: The object which received the signal.
@arg1:
- arg2:
- arg3:
<!-- # Unused Parameters # -->
@type: The #PanelAppletBackgroundType.
@color: The #GdkColor if @type is #PANEL_COLOR_BACKGROUND.
@@ -147,18 +145,6 @@ of the applet's <emphasis>orientation</emphasis>, not the panel's position.
@PANEL_APPLET_ORIENT_LEFT:
@PANEL_APPLET_ORIENT_RIGHT:
-<!-- ##### ENUM PanelAppletBackgroundType ##### -->
-<para>
-The #PanelAppletBackgroundType enumerated type specifies the type of
-background of a panel.
-</para>
-
- PANEL_NO_BACKGROUND: The panel has no background, the default is used.
- PANEL_COLOR_BACKGROUND: The panel has a color, i.e rgb value,
-background.
- PANEL_PIXMAP_BACKGROUND: The panel has either an image background
-or is translucent.
-
<!-- ##### ENUM PanelAppletFlags ##### -->
<para>
The #PanelAppletFlags associated with the applet are boolean flags which
@@ -247,9 +233,10 @@ portion of the panel's background pixmap.
<!-- FIXME: give an example of how to use this -->
@applet: A #PanelApplet.
+ Returns: The background type.
+<!-- # Unused Parameters # -->
@color: A #GdkColor to be filled in.
@pixmap: Returned #GdkPixmap.
- Returns: The background type.
<!-- ##### FUNCTION panel_applet_get_preferences_key ##### -->
diff --git a/gnome-panel/button-widget.c b/gnome-panel/button-widget.c
index 6f2fd6b..0bd1300 100644
--- a/gnome-panel/button-widget.c
+++ b/gnome-panel/button-widget.c
@@ -113,50 +113,18 @@ make_hc_pixbuf (GdkPixbuf *pb)
static void
button_widget_realize(GtkWidget *widget)
{
- GtkAllocation allocation;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkButton *button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (BUTTON_IS_WIDGET (widget));
-
- button = GTK_BUTTON (widget);
-
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = allocation.x;
- attributes.y = allocation.y;
- attributes.width = allocation.width;
- attributes.height = allocation.height;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- gtk_widget_set_window (widget, gtk_widget_get_parent_window (widget));
- g_object_ref (gtk_widget_get_window (widget));
-
- button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes,
- attributes_mask);
- gdk_window_set_user_data (button->event_window, widget);
-
- widget->style = gtk_style_attach (widget->style, gtk_widget_get_window (widget));
+ // FIXMEchpe why?
+ gtk_widget_add_events (widget, GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_KEY_PRESS_MASK);
+
+ GTK_WIDGET_CLASS (button_widget_parent_class)->realize (widget);
BUTTON_WIDGET (widget)->priv->icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
g_signal_connect_object (BUTTON_WIDGET (widget)->priv->icon_theme,
"changed",
G_CALLBACK (button_widget_icon_theme_changed),
- button,
+ widget,
G_CONNECT_SWAPPED);
button_widget_reload_pixbuf (BUTTON_WIDGET (widget));
@@ -165,18 +133,9 @@ button_widget_realize(GtkWidget *widget)
static void
button_widget_unrealize (GtkWidget *widget)
{
- GtkButton *button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (BUTTON_IS_WIDGET (widget));
-
- button = GTK_BUTTON (widget);
-
- if (button->event_window != NULL) {
- gdk_window_set_user_data (button->event_window, NULL);
- gdk_window_destroy (button->event_window);
- button->event_window = NULL;
- }
+ g_signal_handlers_disconnect_by_func (BUTTON_WIDGET (widget)->priv->icon_theme,
+ G_CALLBACK (button_widget_icon_theme_changed),
+ widget);
GTK_WIDGET_CLASS (button_widget_parent_class)->unrealize (widget);
}
@@ -255,8 +214,6 @@ button_widget_get_property (GObject *object,
{
ButtonWidget *button;
- g_return_if_fail (BUTTON_IS_WIDGET (object));
-
button = BUTTON_WIDGET (object);
switch (prop_id) {
@@ -292,8 +249,6 @@ button_widget_set_property (GObject *object,
{
ButtonWidget *button;
- g_return_if_fail (BUTTON_IS_WIDGET (object));
-
button = BUTTON_WIDGET (object);
switch (prop_id) {
@@ -365,39 +320,29 @@ calc_arrow (PanelOrientation orientation,
}
static gboolean
-button_widget_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- ButtonWidget *button_widget;
- GtkButton *button;
- GdkWindow *window;
- GtkAllocation allocation;
- GdkRectangle area, image_bound;
+button_widget_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ ButtonWidget *button_widget = BUTTON_WIDGET (widget);
+ GtkButton *button = GTK_BUTTON (widget);
GtkStyle *style;
int off;
- int x, y, w, h;
+ int width, height;
+ int x, y, w, h;
GdkPixbuf *pb = NULL;
-
- g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget))
- return FALSE;
-
- button_widget = BUTTON_WIDGET (widget);
if (!button_widget->priv->pixbuf_hc && !button_widget->priv->pixbuf)
return FALSE;
- button = GTK_BUTTON (widget);
- window = gtk_widget_get_window (widget);
- gtk_widget_get_allocation (widget, &allocation);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
/* offset for pressed buttons */
off = (button_widget->priv->activatable &&
- button->in_button && button->button_down) ?
- BUTTON_WIDGET_DISPLACEMENT * allocation.height / 48.0 : 0;
+ button->GSEAL(in_button) && button->GSEAL(button_down)) ?
+ BUTTON_WIDGET_DISPLACEMENT * height / 48.0 : 0;
+ /* FIXMEchpe replace this by cairo ops too! */
if (!button_widget->priv->activatable) {
pb = gdk_pixbuf_copy (button_widget->priv->pixbuf);
gdk_pixbuf_saturate_and_pixelate (button_widget->priv->pixbuf,
@@ -405,7 +350,7 @@ button_widget_expose (GtkWidget *widget,
0.8,
TRUE);
} else if (panel_global_config_get_highlight_when_over () &&
- (button->in_button || gtk_widget_has_focus (widget)))
+ (button->GSEAL(in_button) || gtk_widget_has_focus (widget)))
pb = g_object_ref (button_widget->priv->pixbuf_hc);
else
pb = g_object_ref (button_widget->priv->pixbuf);
@@ -414,24 +359,14 @@ button_widget_expose (GtkWidget *widget,
w = gdk_pixbuf_get_width (pb);
h = gdk_pixbuf_get_height (pb);
- x = allocation.x + off + (allocation.width - w)/2;
- y = allocation.y + off + (allocation.height - h)/2;
-
- image_bound.x = x;
- image_bound.y = y;
- image_bound.width = w;
- image_bound.height = h;
-
- area = event->area;
+ x = off + (width - w)/2;
+ y = off + (height - h)/2;
- if (gdk_rectangle_intersect (&area, &allocation, &area) &&
- gdk_rectangle_intersect (&image_bound, &area, &image_bound))
- gdk_draw_pixbuf (window, NULL, pb,
- image_bound.x - x, image_bound.y - y,
- image_bound.x, image_bound.y,
- image_bound.width, image_bound.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, pb, x, y);
+ cairo_rectangle (cr, x, y, w, h);
+ cairo_paint (cr);
+ cairo_restore (cr);
g_object_unref (pb);
@@ -439,56 +374,47 @@ button_widget_expose (GtkWidget *widget,
if (button_widget->priv->arrow) {
GtkArrowType arrow_type;
- int x, y, width, height;
-
- x = y = width = height = -1;
arrow_type = calc_arrow (button_widget->priv->orientation,
- allocation.width,
- allocation.height,
- &x,
- &y,
- &width,
- &height);
+ width,
+ height,
+ &x, &y, &w, &h);
gtk_paint_arrow (style,
- window,
+ cr,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
- NULL,
widget,
"panel-button",
arrow_type,
TRUE,
- allocation.x + x,
- allocation.y + y,
- width,
- height);
+ x, y, w, h);
}
if (button_widget->priv->dnd_highlight) {
- gdk_draw_rectangle(window, style->black_gc, FALSE,
- allocation.x, allocation.y,
- allocation.width - 1,
- allocation.height - 1);
+ cairo_save (cr);
+ cairo_set_line_width (cr, 1);
+ gdk_cairo_set_source_color (cr, &style->black);
+ cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
+ cairo_stroke (cr);
+ cairo_restore (cr);
}
if (gtk_widget_has_focus (widget)) {
gint focus_width, focus_pad;
- gint x, y, width, height;
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
- x = allocation.x + focus_pad;
- y = allocation.y + focus_pad;
- width = allocation.width - 2 * focus_pad;
- height = allocation.height - 2 * focus_pad;
- gtk_paint_focus (style, window,
+ x = focus_pad;
+ y = focus_pad;
+ w= width - 2 * focus_pad;
+ h= height - 2 * focus_pad;
+ gtk_paint_focus (style, cr,
GTK_STATE_NORMAL,
- &event->area, widget, "button",
- x, y, width, height);
+ widget, "button",
+ x, y, w, h);
}
return FALSE;
@@ -511,9 +437,10 @@ button_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
ButtonWidget *button_widget = BUTTON_WIDGET (widget);
- GtkButton *button = GTK_BUTTON (widget);
int size;
+ GTK_WIDGET_CLASS (button_widget_parent_class)->size_allocate (widget, allocation);
+
if (button_widget->priv->orientation & PANEL_HORIZONTAL_MASK)
size = allocation->height;
else
@@ -535,16 +462,6 @@ button_widget_size_allocate (GtkWidget *widget,
button_widget_reload_pixbuf (button_widget);
}
-
- gtk_widget_set_allocation (widget, allocation);
-
- if (gtk_widget_get_realized (widget)) {
- gdk_window_move_resize (button->event_window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
}
static void
@@ -581,9 +498,9 @@ button_widget_enter_notify (GtkWidget *widget, GdkEventCrossing *event)
g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE);
- in_button = GTK_BUTTON (widget)->in_button;
+ in_button = GTK_BUTTON (widget)->GSEAL(in_button);
GTK_WIDGET_CLASS (button_widget_parent_class)->enter_notify_event (widget, event);
- if (in_button != GTK_BUTTON (widget)->in_button &&
+ if (in_button != GTK_BUTTON (widget)->GSEAL(in_button) &&
panel_global_config_get_highlight_when_over ())
gtk_widget_queue_draw (widget);
@@ -597,9 +514,9 @@ button_widget_leave_notify (GtkWidget *widget, GdkEventCrossing *event)
g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE);
- in_button = GTK_BUTTON (widget)->in_button;
+ in_button = GTK_BUTTON (widget)->GSEAL(in_button);
GTK_WIDGET_CLASS (button_widget_parent_class)->leave_notify_event (widget, event);
- if (in_button != GTK_BUTTON (widget)->in_button &&
+ if (in_button != GTK_BUTTON (widget)->GSEAL(in_button) &&
panel_global_config_get_highlight_when_over ())
gtk_widget_queue_draw (widget);
@@ -647,7 +564,7 @@ button_widget_class_init (ButtonWidgetClass *klass)
widget_class->button_press_event = button_widget_button_press;
widget_class->enter_notify_event = button_widget_enter_notify;
widget_class->leave_notify_event = button_widget_leave_notify;
- widget_class->expose_event = button_widget_expose;
+ widget_class->draw = button_widget_draw;
button_class->activate = button_widget_activate;
diff --git a/gnome-panel/drawer.c b/gnome-panel/drawer.c
index d5cefa0..fb1e680 100644
--- a/gnome-panel/drawer.c
+++ b/gnome-panel/drawer.c
@@ -99,8 +99,8 @@ key_press_drawer (GtkWidget *widget,
orient = PANEL_WIDGET (gtk_widget_get_parent (drawer->button))->orient;
switch (event->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
+ case GDK_KEY_Up:
+ case GDK_KEY_KP_Up:
if (orient == GTK_ORIENTATION_HORIZONTAL) {
if (!panel_toplevel_get_is_hidden (drawer->toplevel))
drawer_focus_panel_widget (drawer, GTK_DIR_TAB_BACKWARD);
@@ -109,8 +109,8 @@ key_press_drawer (GtkWidget *widget,
retval = FALSE;
}
break;
- case GDK_Left:
- case GDK_KP_Left:
+ case GDK_KEY_Left:
+ case GDK_KEY_KP_Left:
if (orient == GTK_ORIENTATION_VERTICAL) {
if (!panel_toplevel_get_is_hidden (drawer->toplevel))
drawer_focus_panel_widget (drawer, GTK_DIR_TAB_BACKWARD);
@@ -119,8 +119,8 @@ key_press_drawer (GtkWidget *widget,
retval = FALSE;
}
break;
- case GDK_Down:
- case GDK_KP_Down:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Down:
if (orient == GTK_ORIENTATION_HORIZONTAL) {
if (!panel_toplevel_get_is_hidden (drawer->toplevel))
drawer_focus_panel_widget (drawer, GTK_DIR_TAB_FORWARD);
@@ -129,8 +129,8 @@ key_press_drawer (GtkWidget *widget,
retval = FALSE;
}
break;
- case GDK_Right:
- case GDK_KP_Right:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Right:
if (orient == GTK_ORIENTATION_VERTICAL) {
if (!panel_toplevel_get_is_hidden (drawer->toplevel))
drawer_focus_panel_widget (drawer, GTK_DIR_TAB_FORWARD);
@@ -139,7 +139,7 @@ key_press_drawer (GtkWidget *widget,
retval = FALSE;
}
break;
- case GDK_Escape:
+ case GDK_KEY_Escape:
panel_toplevel_hide (drawer->toplevel, FALSE, -1);
break;
default:
@@ -162,7 +162,7 @@ key_press_drawer_widget (GtkWidget *widget,
{
PanelWidget *panel_widget;
- if (event->keyval != GDK_Escape)
+ if (event->keyval != GDK_KEY_Escape)
return FALSE;
panel_widget = panel_toplevel_get_panel_widget (drawer->toplevel);
diff --git a/gnome-panel/libpanel-util/panel-icon-chooser.c b/gnome-panel/libpanel-util/panel-icon-chooser.c
index 07d1464..c784d00 100644
--- a/gnome-panel/libpanel-util/panel-icon-chooser.c
+++ b/gnome-panel/libpanel-util/panel-icon-chooser.c
@@ -141,7 +141,7 @@ panel_icon_chooser_set_property (GObject *object,
}
static void
-panel_icon_chooser_destroy (GtkObject *object)
+panel_icon_chooser_dispose (GObject *object)
{
PanelIconChooser *chooser;
@@ -166,14 +166,13 @@ panel_icon_chooser_destroy (GtkObject *object)
g_free (chooser->priv->icon_theme_dir);
chooser->priv->icon_theme_dir = NULL;
- GTK_OBJECT_CLASS (panel_icon_chooser_parent_class)->destroy (object);
+ G_OBJECT_CLASS (panel_icon_chooser_parent_class)->dispose (object);
}
static void
panel_icon_chooser_class_init (PanelIconChooserClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (class);
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (class);
GtkButtonClass *gtkbutton_class = GTK_BUTTON_CLASS (class);
@@ -181,7 +180,7 @@ panel_icon_chooser_class_init (PanelIconChooserClass *class)
gobject_class->get_property = panel_icon_chooser_get_property;
gobject_class->set_property = panel_icon_chooser_set_property;
- gtkobject_class->destroy = panel_icon_chooser_destroy;
+ gobject_class->dispose = panel_icon_chooser_dispose;
gtkwidget_class->style_set = _panel_icon_chooser_style_set;
gtkwidget_class->screen_changed = _panel_icon_chooser_screen_changed;
diff --git a/gnome-panel/menu.c b/gnome-panel/menu.c
index bc79856..f191bb8 100644
--- a/gnome-panel/menu.c
+++ b/gnome-panel/menu.c
@@ -837,11 +837,11 @@ restore_grabs(GtkWidget *w, gpointer data)
if (viewable)
xgrab_shell = parent;
- parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+ parent = GTK_MENU_SHELL (parent)->GSEAL(parent_menu_shell);
}
/*only grab if this HAD a grab before*/
- if (xgrab_shell && (GTK_MENU_SHELL (xgrab_shell)->have_xgrab))
+ if (xgrab_shell && (GTK_MENU_SHELL (xgrab_shell)->GSEAL(have_xgrab)))
{
GdkWindow *window = gtk_widget_get_window (xgrab_shell);
@@ -854,7 +854,7 @@ restore_grabs(GtkWidget *w, gpointer data)
{
if (gdk_keyboard_grab (window, TRUE,
GDK_CURRENT_TIME) == 0)
- GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
+ GTK_MENU_SHELL (xgrab_shell)->GSEAL(have_xgrab) = TRUE;
else
gdk_pointer_ungrab (GDK_CURRENT_TIME);
}
@@ -1052,7 +1052,7 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context)
if (viewable)
xgrab_shell = parent;
- parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+ parent = GTK_MENU_SHELL (parent)->GSEAL(parent_menu_shell);
}
if (xgrab_shell && !gtk_menu_get_tearoff_state (GTK_MENU(xgrab_shell)))
@@ -1068,7 +1068,7 @@ drag_end_menu_cb (GtkWidget *widget, GdkDragContext *context)
{
if (gdk_keyboard_grab (window, TRUE,
GDK_CURRENT_TIME) == 0)
- GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
+ GTK_MENU_SHELL (xgrab_shell)->GSEAL(have_xgrab) = TRUE;
else
{
gdk_pointer_ungrab (GDK_CURRENT_TIME);
@@ -1590,8 +1590,8 @@ handle_gmenu_tree_changed (GMenuTree *tree,
{
guint idle_id;
- while (GTK_MENU_SHELL (menu)->children)
- gtk_widget_destroy (GTK_MENU_SHELL (menu)->children->data);
+ while (GTK_MENU_SHELL (menu)->GSEAL(children))
+ gtk_widget_destroy (GTK_MENU_SHELL (menu)->GSEAL(children)->data);
g_object_set_data_full (G_OBJECT (menu),
"panel-menu-tree-directory",
@@ -1904,18 +1904,18 @@ panel_menu_key_press_handler (GtkWidget *widget,
{
gboolean retval = FALSE;
- if ((event->keyval == GDK_Menu) ||
- (event->keyval == GDK_F10 &&
+ if ((event->keyval == GDK_KEY_Menu) ||
+ (event->keyval == GDK_KEY_F10 &&
(event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_SHIFT_MASK)) {
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
- if (menu_shell->active_menu_item &&
- GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL) {
+ if (menu_shell->GSEAL(active_menu_item) &&
+ GTK_MENU_ITEM (menu_shell->GSEAL(active_menu_item))->GSEAL(submenu) == NULL) {
GdkEventButton bevent;
bevent.button = 3;
bevent.time = GDK_CURRENT_TIME;
- retval = show_item_menu (menu_shell->active_menu_item,
+ retval = show_item_menu (menu_shell->GSEAL(active_menu_item),
&bevent);
}
diff --git a/gnome-panel/nothing.cP b/gnome-panel/nothing.cP
index 67e1c8e..8d14843 100644
--- a/gnome-panel/nothing.cP
+++ b/gnome-panel/nothing.cP
@@ -16,6 +16,8 @@
#include "panel-util.h"
#include "nothing.h"
+#if 0
+
static void
pixbuf_reverse (GdkPixbuf *gp)
{
@@ -248,10 +250,13 @@ goat_realize(GtkWidget *widget)
}
}
+#endif
+
/*thy evil easter egg*/
int
config_event(GtkWidget *widget,GdkEvent *event,GtkNotebook *nbook)
{
+#if 0
static int clicks=0;
GdkEventButton *bevent;
@@ -295,9 +300,12 @@ config_event(GtkWidget *widget,GdkEvent *event,GtkNotebook *nbook)
} else {
gtk_notebook_set_current_page(nbook,-1);
}
+#endif
return FALSE;
}
+#if 0
+
/* phish code */
#define PHSHFRAMES 8
#define PHSHORIGWIDTH 288
@@ -534,15 +542,21 @@ check_screen_timeout (gpointer data)
return FALSE;
}
+#endif
+
void
start_screen_check (void)
{
+#if 0
if (screen_check_id > 0)
g_source_remove (screen_check_id);
check_screen_timeout (NULL);
+#endif
}
+#if 0
+
typedef struct {
gboolean live;
int x, y;
@@ -1352,9 +1366,12 @@ inv_expose (GtkWidget *widget, GdkEventExpose *event)
return FALSE;
}
+#endif
+
void
start_geginv (void)
{
+#if 0
GtkWidget *vbox;
int i, j;
@@ -1446,8 +1463,11 @@ start_geginv (void)
inv_show_status ();
gtk_widget_show_all (geginv);
+#endif
}
+#if 0
+
static gboolean
move_window_handler (gpointer data)
{
@@ -1534,11 +1554,13 @@ doblah (GtkWidget *window)
NULL);
}
}
+#endif
gboolean
panel_dialog_window_event (GtkWidget *window,
GdkEvent *event)
{
+#if 0
switch (event->type) {
static int foo = 0;
case GDK_KEY_PRESS:
@@ -1563,6 +1585,6 @@ panel_dialog_window_event (GtkWidget *window,
default:
break;
}
-
+#endif
return FALSE;
}
diff --git a/gnome-panel/panel-action-protocol.c b/gnome-panel/panel-action-protocol.c
index c18a3cf..ec1632f 100644
--- a/gnome-panel/panel-action-protocol.c
+++ b/gnome-panel/panel-action-protocol.c
@@ -110,7 +110,7 @@ panel_action_protocol_filter (GdkXEvent *gdk_xevent,
if (!window)
return GDK_FILTER_CONTINUE;
- screen = gdk_drawable_get_screen (window);
+ screen = gdk_window_get_screen (window);
if (xevent->xclient.data.l [0] == atom_gnome_panel_action_main_menu)
panel_action_protocol_main_menu (screen, xevent->xclient.data.l [1]);
diff --git a/gnome-panel/panel-addto.c b/gnome-panel/panel-addto.c
index 635424a..5f62ad7 100644
--- a/gnome-panel/panel-addto.c
+++ b/gnome-panel/panel-addto.c
@@ -1288,8 +1288,6 @@ panel_addto_dialog_new (PanelWidget *panel_widget)
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), FALSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog->addto_dialog),
- FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog->addto_dialog),
PANEL_ADDTO_RESPONSE_ADD);
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index a411bf0..3f3b774 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -90,21 +90,20 @@ struct _PanelAppletFramePrivate {
guint has_handle : 1;
};
-static void
-panel_applet_frame_paint (GtkWidget *widget,
- GdkRectangle *area)
+static gboolean
+panel_applet_frame_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- PanelAppletFrame *frame;
+ PanelAppletFrame *frame = PANEL_APPLET_FRAME (widget);
+ GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
- frame = PANEL_APPLET_FRAME (widget);
+ if (GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->draw)
+ GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->draw (widget, cr);
if (!frame->priv->has_handle)
- return;
+ return FALSE;
- if (gtk_widget_is_drawable (widget)) {
- GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
-
- switch (frame->priv->orientation) {
+ switch (frame->priv->orientation) {
case PANEL_ORIENTATION_TOP:
case PANEL_ORIENTATION_BOTTOM:
orientation = GTK_ORIENTATION_VERTICAL;
@@ -116,32 +115,20 @@ panel_applet_frame_paint (GtkWidget *widget,
default:
g_assert_not_reached ();
break;
- }
+ }
- gtk_paint_handle (
- gtk_widget_get_style (widget), gtk_widget_get_window (widget),
- gtk_widget_get_state (widget),
- GTK_SHADOW_OUT,
- area, widget, "handlebox",
- frame->priv->handle_rect.x,
- frame->priv->handle_rect.y,
- frame->priv->handle_rect.width,
- frame->priv->handle_rect.height,
- orientation);
- }
-}
-
-static gboolean
-panel_applet_frame_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- if (gtk_widget_is_drawable (widget)) {
- GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->expose_event (widget, event);
-
- panel_applet_frame_paint (widget, &event->area);
- }
+ gtk_paint_handle (gtk_widget_get_style (widget),
+ cr,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_OUT,
+ widget, "handlebox",
+ frame->priv->handle_rect.x,
+ frame->priv->handle_rect.y,
+ frame->priv->handle_rect.width,
+ frame->priv->handle_rect.height,
+ orientation);
- return FALSE;
+ return FALSE;
}
static void
@@ -405,7 +392,7 @@ panel_applet_frame_class_init (PanelAppletFrameClass *klass)
gobject_class->finalize = panel_applet_frame_finalize;
- widget_class->expose_event = panel_applet_frame_expose;
+ widget_class->draw = panel_applet_frame_draw;
widget_class->size_request = panel_applet_frame_size_request;
widget_class->size_allocate = panel_applet_frame_size_allocate;
widget_class->button_press_event = panel_applet_frame_button_changed;
diff --git a/gnome-panel/panel-background-monitor.c b/gnome-panel/panel-background-monitor.c
index ceb659d..fc85e17 100644
--- a/gnome-panel/panel-background-monitor.c
+++ b/gnome-panel/panel-background-monitor.c
@@ -30,6 +30,7 @@
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
+#include <cairo-xlib.h>
#include "panel-background-monitor.h"
#include "panel-util.h"
@@ -61,8 +62,8 @@ struct _PanelBackgroundMonitor {
Atom xatom;
GdkAtom gdkatom;
- GdkPixmap *gdkpixmap;
- GdkPixbuf *gdkpixbuf;
+ cairo_surface_t *surface;
+ GdkPixbuf *gdkpixbuf; // FIXMEchpe this is insane!!!
int width;
int height;
@@ -88,9 +89,9 @@ panel_background_monitor_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (monitor->screen,
panel_background_monitor_changed, monitor);
- if (monitor->gdkpixmap)
- g_object_unref (monitor->gdkpixmap);
- monitor->gdkpixmap = NULL;
+ if (monitor->surface)
+ cairo_surface_destroy (monitor->surface);
+ monitor->surface= NULL;
if (monitor->gdkpixbuf)
g_object_unref (monitor->gdkpixbuf);
@@ -127,7 +128,7 @@ panel_background_monitor_init (PanelBackgroundMonitor *monitor)
monitor->gdkatom = gdk_atom_intern_static_string ("_XROOTPMAP_ID");
monitor->xatom = gdk_x11_atom_to_xatom (monitor->gdkatom);
- monitor->gdkpixmap = NULL;
+ monitor->surface = NULL;
monitor->gdkpixbuf = NULL;
monitor->display_grabbed = FALSE;
@@ -202,9 +203,9 @@ panel_background_monitor_get_for_screen (GdkScreen *screen)
static void
panel_background_monitor_changed (PanelBackgroundMonitor *monitor)
{
- if (monitor->gdkpixmap)
- g_object_unref (monitor->gdkpixmap);
- monitor->gdkpixmap = NULL;
+ if (monitor->surface)
+ cairo_surface_destroy (monitor->surface);
+ monitor->surface = NULL;
if (monitor->gdkpixbuf)
g_object_unref (monitor->gdkpixbuf);
@@ -234,35 +235,102 @@ panel_background_monitor_xevent_filter (GdkXEvent *xevent,
return GDK_FILTER_CONTINUE;
}
-static void
-panel_background_monitor_setup_pixmap (PanelBackgroundMonitor *monitor)
+/* copied from gnome-desktop. FIXMEchpe: switch panel-background{,-monitor} over to libgnome-desktop! */
+static cairo_surface_t *
+gnome_bg_get_surface_from_root (GdkScreen *screen,
+ int *widthptr,
+ int *heightptr)
{
- Pixmap *prop_data = NULL;
- GdkAtom prop_type;
-
- g_assert (monitor->display_grabbed);
-
- if (!gdk_property_get (
- monitor->gdkwindow, monitor->gdkatom,
- gdk_x11_xatom_to_atom (XA_PIXMAP), 0, 10,
- FALSE, &prop_type, NULL, NULL, (gpointer) &prop_data))
- return;
-
- if ((prop_type == GDK_TARGET_PIXMAP) && prop_data && prop_data [0]) {
- GdkDisplay *display;
-
- g_assert (monitor->gdkpixmap == NULL);
-
- display = gdk_screen_get_display (monitor->screen);
-
- monitor->gdkpixmap = gdk_pixmap_foreign_new_for_display (display,
- prop_data [0]);
-
- if (!monitor->gdkpixmap)
- g_warning ("couldn't get background pixmap\n");
- }
-
- g_free (prop_data);
+ int result;
+ gint format;
+ gulong nitems;
+ gulong bytes_after;
+ guchar *data;
+ Atom type;
+ Display *display;
+ int screen_num;
+ cairo_surface_t *surface;
+ cairo_surface_t *source_pixmap;
+ int width, height;
+ cairo_t *cr;
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+ screen_num = gdk_screen_get_number (screen);
+
+ result = XGetWindowProperty (display,
+ RootWindow (display, screen_num),
+ gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+ 0L, 1L, False, XA_PIXMAP,
+ &type, &format, &nitems, &bytes_after,
+ &data);
+ surface = NULL;
+ source_pixmap = NULL;
+
+ if (result != Success || type != XA_PIXMAP ||
+ format != 32 || nitems != 1) {
+ XFree (data);
+ data = NULL;
+ }
+
+ if (data != NULL) {
+ Pixmap xpixmap = *(Pixmap *) data;
+ Window root_return;
+ int x_ret, y_ret;
+ unsigned int w_ret, h_ret, bw_ret, depth_ret;
+
+ gdk_error_trap_push ();
+ if (XGetGeometry (GDK_SCREEN_XDISPLAY (screen),
+ xpixmap,
+ &root_return,
+ &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) {
+ source_pixmap = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen),
+ xpixmap,
+ GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
+ w_ret, h_ret);
+ }
+
+ gdk_error_trap_pop_ignored ();
+ }
+
+ width = gdk_screen_get_width (screen);
+ height = gdk_screen_get_height (screen);
+
+ if (source_pixmap) {
+ surface = cairo_surface_create_similar (source_pixmap,
+ CAIRO_CONTENT_COLOR,
+ width, height);
+
+ cr = cairo_create (surface);
+ cairo_set_source_surface (cr, source_pixmap, 0, 0);
+ cairo_paint (cr);
+
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+ cairo_surface_destroy (surface);
+ surface = NULL;
+ }
+
+ cairo_destroy (cr);
+ }
+
+#if 0
+ /* We don't need this fallback here */
+ if (surface == NULL) {
+ surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
+ CAIRO_CONTENT_COLOR,
+ width, height);
+ }
+#endif
+
+ if (source_pixmap != NULL)
+ cairo_surface_destroy (source_pixmap);
+
+ if (data != NULL)
+ XFree (data);
+
+ *widthptr = width;
+ *heightptr = height;
+
+ return surface;
}
static GdkPixbuf *
@@ -333,7 +401,6 @@ panel_background_monitor_tile_background (PanelBackgroundMonitor *monitor,
static void
panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor)
{
- GdkColormap *colormap = NULL;
GdkDisplay *display;
int rwidth, rheight;
int pwidth, pheight;
@@ -343,31 +410,28 @@ panel_background_monitor_setup_pixbuf (PanelBackgroundMonitor *monitor)
gdk_x11_display_grab (display);
monitor->display_grabbed = TRUE;
- if (!monitor->gdkpixmap)
- panel_background_monitor_setup_pixmap (monitor);
+ if (!monitor->surface) {
+ monitor->surface = gnome_bg_get_surface_from_root (monitor->screen,
+ &pwidth, &pheight);
+ if (!monitor->surface)
+ g_warning ("couldn't get background pixmap\n");
+ }
- if (!monitor->gdkpixmap) {
+ if (!monitor->surface) {
gdk_x11_display_ungrab (display);
monitor->display_grabbed = FALSE;
return;
}
- gdk_drawable_get_size (
- GDK_DRAWABLE (monitor->gdkpixmap), &pwidth, &pheight);
-
gdk_window_get_geometry (monitor->gdkwindow,
NULL, NULL, &rwidth, &rheight, NULL);
monitor->width = MIN (pwidth, rwidth);
monitor->height = MIN (pheight, rheight);
- colormap = gdk_drawable_get_colormap (monitor->gdkwindow);
-
g_assert (monitor->gdkpixbuf == NULL);
- monitor->gdkpixbuf = gdk_pixbuf_get_from_drawable (
- NULL, monitor->gdkpixmap, colormap,
- 0, 0, 0, 0,
- monitor->width, monitor->height);
+ monitor->gdkpixbuf = gdk_pixbuf_get_from_surface (monitor->surface,
+ 0, 0, monitor->width, monitor->height);
gdk_x11_display_ungrab (display);
monitor->display_grabbed = FALSE;
diff --git a/gnome-panel/panel-background.c b/gnome-panel/panel-background.c
index 6341b29..0c70216 100644
--- a/gnome-panel/panel-background.c
+++ b/gnome-panel/panel-background.c
@@ -48,22 +48,10 @@ free_prepared_resources (PanelBackground *background)
case PANEL_BACK_NONE:
break;
case PANEL_BACK_COLOR:
- if (background->has_alpha) {
- if (background->pixmap)
- g_object_unref (background->pixmap);
- background->pixmap = NULL;
- } else {
- if (background->colormap && background->color.gdk.pixel)
- gdk_colormap_free_colors (
- background->colormap,
- &background->color.gdk, 1);
- background->color.gdk.pixel = 0;
- }
+ if (!background->has_alpha)
+ background->color.red = background->color.green = background->color.blue = 0.;
break;
case PANEL_BACK_IMAGE:
- if (background->pixmap)
- g_object_unref (background->pixmap);
- background->pixmap = NULL;
break;
default:
g_assert_not_reached ();
@@ -74,15 +62,9 @@ free_prepared_resources (PanelBackground *background)
static void
set_pixbuf_background (PanelBackground *background)
{
- g_assert (background->composited_image != NULL);
-
- gdk_pixbuf_render_pixmap_and_mask_for_colormap (
- background->composited_image,
- background->colormap,
- &background->pixmap, NULL, 128);
+ g_assert (background->composited_pattern != NULL);
- gdk_window_set_back_pixmap (
- background->window, background->pixmap, FALSE);
+ gdk_window_set_background_pattern (background->window, background->composited_pattern);
}
static gboolean
@@ -91,7 +73,7 @@ panel_background_prepare (PanelBackground *background)
PanelBackgroundType effective_type;
GtkWidget *widget = NULL;
- if (!background->colormap || !background->transformed)
+ if (!background->transformed)
return FALSE;
free_prepared_resources (background);
@@ -100,31 +82,20 @@ panel_background_prepare (PanelBackground *background)
switch (effective_type) {
case PANEL_BACK_NONE:
- if (background->default_pixmap) {
- if (background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE)
- gdk_window_set_back_pixmap (background->window,
- background->default_pixmap,
- FALSE);
- else
- gdk_window_set_back_pixmap (background->window,
- NULL,
- TRUE);
- } else
+ if (background->default_pattern)
+ gdk_window_set_background_pattern (background->window,
+ background->default_pattern);
+ else
gdk_window_set_background (
background->window, &background->default_color);
break;
case PANEL_BACK_COLOR:
if (background->has_alpha &&
- background->composited_image)
+ background->composited_pattern)
set_pixbuf_background (background);
- else {
- gdk_colormap_alloc_color (
- background->colormap,
- &background->color.gdk,
- FALSE, TRUE);
- gdk_window_set_background (
- background->window, &background->color.gdk);
- }
+ else
+ gdk_window_set_background_rgba (background->window,
+ &background->color);
break;
case PANEL_BACK_IMAGE:
set_pixbuf_background (background);
@@ -138,7 +109,7 @@ panel_background_prepare (PanelBackground *background)
* decide how to draw themselves. Therefore, we need to
* make sure that all drawing has been completed before
* the applet looks at the pixmap. */
- gdk_display_sync (gdk_drawable_get_display (background->window));
+ gdk_display_sync (gdk_window_get_display (background->window));
gdk_window_get_user_data (GDK_WINDOW (background->window),
(gpointer) &widget);
@@ -160,9 +131,9 @@ free_composited_resources (PanelBackground *background)
background->composited = FALSE;
- if (background->composited_image)
- g_object_unref (background->composited_image);
- background->composited_image = NULL;
+ if (background->composited_pattern)
+ cairo_pattern_destroy (background->composited_pattern);
+ background->composited_pattern = NULL;
}
static void
@@ -186,6 +157,7 @@ background_changed (PanelBackgroundMonitor *monitor,
panel_background_composite (background);
}
+// FIXMEchpe make this a cairo_pattern_t*
static GdkPixbuf *
get_desktop_pixbuf (PanelBackground *background)
{
@@ -194,7 +166,7 @@ get_desktop_pixbuf (PanelBackground *background)
if (!background->monitor) {
background->monitor =
panel_background_monitor_get_for_screen (
- gdk_drawable_get_screen (background->window));
+ gdk_window_get_screen (background->window));
background->monitor_signal =
g_signal_connect (
@@ -212,10 +184,10 @@ get_desktop_pixbuf (PanelBackground *background)
return desktop;
}
-static GdkPixbuf *
+static cairo_pattern_t *
composite_image_onto_desktop (PanelBackground *background)
{
- GdkPixbuf *retval;
+ static const cairo_user_data_key_t key;
int width, height;
unsigned char *data;
cairo_t *cr;
@@ -235,10 +207,13 @@ composite_image_onto_desktop (PanelBackground *background)
if (!data)
return NULL;
+ // FIXMEchpe use surface similar to window or root window!
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_RGB24,
width, height,
width * 4);
+ cairo_surface_set_user_data (surface, &key, data, (cairo_destroy_func_t) g_free);
+
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
@@ -247,68 +222,79 @@ composite_image_onto_desktop (PanelBackground *background)
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
- gdk_cairo_set_source_pixbuf (cr, background->transformed_image, 0, 0);
- pattern = cairo_get_source (cr);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+ cairo_set_source (cr, background->transformed_pattern);
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
cairo_destroy (cr);
- cairo_surface_destroy (surface);
-
- retval = panel_util_cairo_rgbdata_to_pixbuf (data, width, height);
- g_free (data);
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_surface_destroy (surface);
- return retval;
+ return pattern;
}
-static GdkPixbuf *
+static cairo_pattern_t *
composite_color_onto_desktop (PanelBackground *background)
{
- guint32 color;
+ cairo_surface_t *surface;
+ cairo_pattern_t *pattern;
+ cairo_t *cr;
- if (!background->desktop)
- background->desktop = get_desktop_pixbuf (background);
+ if (!background->desktop)
+ background->desktop = get_desktop_pixbuf (background);
+ if (!background->desktop)
+ return NULL;
- if (!background->desktop)
- return NULL;
+ surface = gdk_window_create_similar_surface (background->window,
+ CAIRO_CONTENT_COLOR_ALPHA,
+ background->region.width,
+ background->region.height);
+ if (cairo_surface_status (surface)) {
+ cairo_surface_destroy (surface);
+ return NULL;
+ }
+
+ // FIXMEchpe is this correct way to composite here?
+
+ cr = cairo_create (surface);
+ gdk_cairo_set_source_pixbuf (cr, background->desktop,
+ -background->region.x, -background->region.y);
+ cairo_paint (cr);
+
+ gdk_cairo_set_source_rgba (cr, &background->color);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
- color = ((background->color.gdk.red & 0xff00) << 8) +
- (background->color.gdk.green & 0xff00) +
- (background->color.gdk.blue >> 8);
-
- return gdk_pixbuf_composite_color_simple (
- background->desktop,
- gdk_pixbuf_get_width (background->desktop),
- gdk_pixbuf_get_height (background->desktop),
- GDK_INTERP_NEAREST,
- (255 - (background->color.alpha >> 8)),
- 255, color, color);
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_surface_destroy (surface);
+
+ return pattern;
}
-static GdkPixbuf *
-get_composited_pixbuf (PanelBackground *background)
+static cairo_pattern_t *
+get_composited_pattern (PanelBackground *background)
{
- GdkPixbuf *retval = NULL;
+ cairo_pattern_t *pattern;
switch (background->type) {
case PANEL_BACK_NONE:
break;
case PANEL_BACK_COLOR:
- retval = composite_color_onto_desktop (background);
+ pattern = composite_color_onto_desktop (background);
break;
case PANEL_BACK_IMAGE:
- retval = composite_image_onto_desktop (background);
- if (!retval)
- retval = g_object_ref (background->transformed_image);
+ pattern = composite_image_onto_desktop (background);
+ if (!pattern && background->transformed_pattern);
+ pattern = cairo_pattern_reference (background->transformed_pattern);
break;
default:
g_assert_not_reached ();
break;
}
- return retval;
+ return pattern;
}
static gboolean
@@ -324,17 +310,17 @@ panel_background_composite (PanelBackground *background)
break;
case PANEL_BACK_COLOR:
if (background->has_alpha)
- background->composited_image =
- get_composited_pixbuf (background);
+ background->composited_pattern =
+ get_composited_pattern (background);
break;
case PANEL_BACK_IMAGE:
- if (background->transformed_image) {
+ if (background->transformed_pattern) {
if (background->has_alpha)
- background->composited_image =
- get_composited_pixbuf (background);
+ background->composited_pattern =
+ get_composited_pattern (background);
else
- background->composited_image =
- g_object_ref (background->transformed_image);
+ background->composited_pattern =
+ cairo_pattern_reference (background->transformed_pattern);
}
break;
default:
@@ -359,16 +345,17 @@ free_transformed_resources (PanelBackground *background)
if (background->type != PANEL_BACK_IMAGE)
return;
- if (background->transformed_image)
- g_object_unref (background->transformed_image);
- background->transformed_image = NULL;
+ if (background->transformed_pattern)
+ cairo_pattern_destroy (background->transformed_pattern);
+ background->transformed_pattern = NULL;
}
-static GdkPixbuf *
-get_scaled_and_rotated_pixbuf (PanelBackground *background)
+static cairo_pattern_t *
+get_scaled_and_rotated_pattern (PanelBackground *background)
{
GdkPixbuf *scaled;
GdkPixbuf *retval;
+ cairo_pattern_t *pattern;
int orig_width, orig_height;
int panel_width, panel_height;
int width, height;
@@ -484,7 +471,19 @@ get_scaled_and_rotated_pixbuf (PanelBackground *background)
} else
retval = scaled;
- return retval;
+ // FIXMEchpe this sucks
+ {
+ cairo_t *cr = gdk_cairo_create (background->window ? background->window : gdk_get_default_root_window());
+ gdk_cairo_set_source_pixbuf (cr, retval, 0, 0);
+ g_object_unref (retval);
+
+ pattern = cairo_pattern_reference (cairo_get_source (cr));
+ cairo_destroy (cr);
+ }
+
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+
+ return pattern;
}
static gboolean
@@ -496,8 +495,8 @@ panel_background_transform (PanelBackground *background)
free_transformed_resources (background);
if (background->type == PANEL_BACK_IMAGE)
- background->transformed_image =
- get_scaled_and_rotated_pixbuf (background);
+ background->transformed_pattern =
+ get_scaled_and_rotated_pattern (background);
background->transformed = TRUE;
@@ -579,73 +578,26 @@ panel_background_set_type (PanelBackground *background,
}
static void
-panel_background_set_gdk_color_no_update (PanelBackground *background,
- GdkColor *gdk_color)
-{
- g_return_if_fail (gdk_color != NULL);
-
- background->color.gdk.red = gdk_color->red;
- background->color.gdk.green = gdk_color->green;
- background->color.gdk.blue = gdk_color->blue;
-}
-
-void
-panel_background_set_gdk_color (PanelBackground *background,
- GdkColor *gdk_color)
-{
- g_return_if_fail (gdk_color != NULL);
-
- if (background->color.gdk.red == gdk_color->red &&
- background->color.gdk.green == gdk_color->green &&
- background->color.gdk.blue == gdk_color->blue)
- return;
-
- free_transformed_resources (background);
- panel_background_set_gdk_color_no_update (background, gdk_color);
- panel_background_transform (background);
-}
-
-static void
-panel_background_set_opacity_no_update (PanelBackground *background,
- guint16 opacity)
-{
- background->color.alpha = opacity;
- panel_background_update_has_alpha (background);
-}
-
-void
-panel_background_set_opacity (PanelBackground *background,
- guint16 opacity)
-{
- if (background->color.alpha == opacity)
- return;
-
- free_transformed_resources (background);
- panel_background_set_opacity_no_update (background, opacity);
- panel_background_transform (background);
-}
-
-static void
panel_background_set_color_no_update (PanelBackground *background,
- PanelColor *color)
+ const GdkRGBA *color)
{
g_return_if_fail (color != NULL);
- panel_background_set_gdk_color_no_update (background, &(color->gdk));
- panel_background_set_opacity_no_update (background, color->alpha);
+ if (gdk_rgba_equal (color, &background->color))
+ return;
+
+ background->color = *color;
+ panel_background_update_has_alpha (background);
}
void
panel_background_set_color (PanelBackground *background,
- PanelColor *color)
+ const GdkRGBA *color)
{
g_return_if_fail (color != NULL);
- if (background->color.gdk.red == color->gdk.red &&
- background->color.gdk.green == color->gdk.green &&
- background->color.gdk.blue == color->gdk.blue &&
- background->color.alpha == color->alpha)
- return;
+ if (gdk_rgba_equal (color, &background->color))
+ return;
free_transformed_resources (background);
panel_background_set_color_no_update (background, color);
@@ -751,7 +703,7 @@ panel_background_set_rotate (PanelBackground *background,
void
panel_background_set (PanelBackground *background,
PanelBackgroundType type,
- PanelColor *color,
+ const GdkRGBA *color,
const char *image,
gboolean fit_image,
gboolean stretch_image,
@@ -768,20 +720,19 @@ panel_background_set (PanelBackground *background,
void
panel_background_set_default_style (PanelBackground *background,
GdkColor *color,
- GdkPixmap *pixmap)
+ cairo_pattern_t *pattern)
{
g_return_if_fail (color != NULL);
background->default_color = *color;
- if (pixmap && pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE)
- g_object_ref (pixmap);
+ if (pattern)
+ cairo_pattern_reference (pattern);
- if (background->default_pixmap
- && background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE)
- g_object_unref (background->default_pixmap);
+ if (background->default_pattern)
+ cairo_pattern_destroy (background->default_pattern);
- background->default_pixmap = pixmap;
+ background->default_pattern = pattern;
if (background->type == PANEL_BACK_NONE)
panel_background_prepare (background);
@@ -793,18 +744,10 @@ panel_background_realized (PanelBackground *background,
{
g_return_if_fail (window != NULL);
- if (background->window && background->colormap && background->gc)
+ if (background->window)
return;
- if (!background->window)
- background->window = g_object_ref (window);
-
- if (!background->colormap)
- background->colormap =
- g_object_ref (gdk_drawable_get_colormap (window));
-
- if (!background->gc)
- background->gc = gdk_gc_new (window);
+ background->window = g_object_ref (window);
panel_background_prepare (background);
}
@@ -817,14 +760,6 @@ panel_background_unrealized (PanelBackground *background)
if (background->window)
g_object_unref (background->window);
background->window = NULL;
-
- if (background->colormap)
- g_object_unref (background->colormap);
- background->colormap = NULL;
-
- if (background->gc)
- g_object_unref (background->gc);
- background->gc = NULL;
}
void
@@ -904,11 +839,10 @@ panel_background_init (PanelBackground *background,
background->notify_changed = notify_changed;
background->user_data = user_data;
- background->color.gdk.red = 0;
- background->color.gdk.blue = 0;
- background->color.gdk.green = 0;
- background->color.gdk.pixel = 0;
- background->color.alpha = 0xffff;
+ background->color.red = 0.;
+ background->color.blue = 0.;
+ background->color.green = 0.;
+ background->color.alpha = 1.;
background->image = NULL;
background->loaded_image = NULL;
@@ -918,19 +852,16 @@ panel_background_init (PanelBackground *background,
background->region.y = -1;
background->region.width = -1;
background->region.height = -1;
- background->transformed_image = NULL;
- background->composited_image = NULL;
+ background->transformed_pattern = NULL;
+ background->composited_pattern = NULL;
background->monitor = NULL;
background->desktop = NULL;
background->monitor_signal = -1;
- background->pixmap = NULL;
background->window = NULL;
- background->colormap = NULL;
- background->gc = NULL;
- background->default_pixmap = NULL;
+ background->default_pattern = NULL;
background->default_color.red = 0;
background->default_color.green = 0;
background->default_color.blue = 0;
@@ -970,18 +901,9 @@ panel_background_free (PanelBackground *background)
g_object_unref (background->window);
background->window = NULL;
- if (background->colormap)
- g_object_unref (background->colormap);
- background->colormap = NULL;
-
- if (background->gc)
- g_object_unref (background->gc);
- background->gc = NULL;
-
- if (background->default_pixmap
- && background->default_pixmap != (GdkPixmap*) GDK_PARENT_RELATIVE)
- g_object_unref (background->default_pixmap);
- background->default_pixmap = NULL;
+ if (background->default_pattern)
+ cairo_pattern_destroy (background->default_pattern);
+ background->default_pattern = NULL;
}
char *
@@ -989,6 +911,7 @@ panel_background_make_string (PanelBackground *background,
int x,
int y)
{
+#if 0
PanelBackgroundType effective_type;
char *retval;
@@ -1018,7 +941,8 @@ panel_background_make_string (PanelBackground *background,
retval = g_strdup ("none:");
return retval;
-
+#endif
+ return g_strdup ("none:"); // FIXMEchpe !!!
}
PanelBackgroundType
@@ -1027,19 +951,12 @@ panel_background_get_type (PanelBackground *background)
return background->type;
}
-const PanelColor *
+const GdkRGBA *
panel_background_get_color (PanelBackground *background)
{
return &(background->color);
}
-const GdkPixmap *
-panel_background_get_pixmap (PanelBackground *background)
-{
- return background->pixmap;
-}
-
-
/* What are we actually rendering - e.g. if we're supposed to
* be rendering an image, but haven't got a valid image, then
* we're rendering the default gtk background.
@@ -1050,7 +967,7 @@ panel_background_effective_type (PanelBackground *background)
PanelBackgroundType retval;
retval = background->type;
- if (background->type == PANEL_BACK_IMAGE && !background->composited_image)
+ if (background->type == PANEL_BACK_IMAGE && !background->composited_pattern)
retval = PANEL_BACK_NONE;
return retval;
@@ -1072,6 +989,8 @@ static void
panel_background_set_image_background_on_widget (PanelBackground *background,
GtkWidget *widget)
{
+ // FIXMEchpe!!!
+#if 0
const GdkPixmap *bg_pixmap;
GtkAllocation allocation;
GdkPixmap *pixmap;
@@ -1110,22 +1029,27 @@ panel_background_set_image_background_on_widget (PanelBackground *background,
g_object_unref (style);
g_object_unref (pixmap);
+#endif
}
static void
panel_background_set_color_background_on_widget (PanelBackground *background,
GtkWidget *widget)
{
- const PanelColor *color;
+ const GdkRGBA *color;
+ GdkColor gdkcolor;
color = panel_background_get_color (background);
- if (color->alpha != 0xffff) {
+ if (color->alpha < 1.) {
panel_background_set_image_background_on_widget (background,
widget);
return;
}
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color->gdk);
+ gdkcolor.red = color->red * 65535.;
+ gdkcolor.green = color->green * 65535.;
+ gdkcolor.blue = color->blue * 65535.;
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &gdkcolor);
}
void
diff --git a/gnome-panel/panel-background.h b/gnome-panel/panel-background.h
index a39ae4c..6fe9660 100644
--- a/gnome-panel/panel-background.h
+++ b/gnome-panel/panel-background.h
@@ -44,25 +44,22 @@ struct _PanelBackground {
PanelBackgroundChangedNotify notify_changed;
gpointer user_data;
- PanelColor color;
+ GdkRGBA color;
char *image;
GdkPixbuf *loaded_image;
GtkOrientation orientation;
GdkRectangle region;
- GdkPixbuf *transformed_image;
- GdkPixbuf *composited_image;
+ cairo_pattern_t *transformed_pattern;
+ cairo_pattern_t *composited_pattern;
PanelBackgroundMonitor *monitor;
GdkPixbuf *desktop;
gulong monitor_signal;
- GdkPixmap *pixmap;
GdkWindow *window;
- GdkColormap *colormap;
- GdkGC *gc;
- GdkPixmap *default_pixmap;
+ cairo_pattern_t *default_pattern;
GdkColor default_color;
guint fit_image : 1;
@@ -83,19 +80,15 @@ void panel_background_init (PanelBackground *background,
void panel_background_free (PanelBackground *background);
void panel_background_set (PanelBackground *background,
PanelBackgroundType type,
- PanelColor *color,
+ const GdkRGBA *color,
const char *image,
gboolean fit_image,
gboolean stretch_image,
gboolean rotate_image);
void panel_background_set_type (PanelBackground *background,
PanelBackgroundType type);
-void panel_background_set_gdk_color (PanelBackground *background,
- GdkColor *gdk_color);
-void panel_background_set_opacity (PanelBackground *background,
- guint16 opacity);
void panel_background_set_color (PanelBackground *background,
- PanelColor *color);
+ const GdkRGBA *color);
void panel_background_set_image (PanelBackground *background,
const char *image);
void panel_background_set_fit (PanelBackground *background,
@@ -106,7 +99,7 @@ void panel_background_set_rotate (PanelBackground *background,
gboolean rotate_image);
void panel_background_set_default_style (PanelBackground *background,
GdkColor *color,
- GdkPixmap *pixmap);
+ cairo_pattern_t *pattern);
void panel_background_realized (PanelBackground *background,
GdkWindow *window);
void panel_background_unrealized (PanelBackground *background);
@@ -121,8 +114,7 @@ char *panel_background_make_string (PanelBackground *background,
int y);
PanelBackgroundType panel_background_get_type (PanelBackground *background);
-const PanelColor *panel_background_get_color (PanelBackground *background);
-const GdkPixmap *panel_background_get_pixmap (PanelBackground *background);
+const GdkRGBA *panel_background_get_color (PanelBackground *background);
PanelBackgroundType
panel_background_effective_type (PanelBackground *background);
diff --git a/gnome-panel/panel-context-menu.c b/gnome-panel/panel-context-menu.c
index eb93b1b..558a70f 100644
--- a/gnome-panel/panel-context-menu.c
+++ b/gnome-panel/panel-context-menu.c
@@ -65,8 +65,8 @@ panel_context_menu_check_for_screen (GtkWidget *w,
static int times = 0;
if (ev->type != GDK_KEY_PRESS)
return FALSE;
- if (ev->key.keyval == GDK_f ||
- ev->key.keyval == GDK_F) {
+ if (ev->key.keyval == GDK_KEY_f ||
+ ev->key.keyval == GDK_KEY_F) {
times++;
if (times == 3) {
times = 0;
diff --git a/gnome-panel/panel-ditem-editor.c b/gnome-panel/panel-ditem-editor.c
index 58a5d0b..da68a24 100644
--- a/gnome-panel/panel-ditem-editor.c
+++ b/gnome-panel/panel-ditem-editor.c
@@ -338,7 +338,7 @@ panel_ditem_editor_set_property (GObject *object,
}
static void
-panel_ditem_editor_destroy (GtkObject *object)
+panel_ditem_editor_dispose (GObject *object)
{
PanelDItemEditor *dialog;
@@ -366,20 +366,18 @@ panel_ditem_editor_destroy (GtkObject *object)
g_free (dialog->priv->uri);
dialog->priv->uri = NULL;
- GTK_OBJECT_CLASS (panel_ditem_editor_parent_class)->destroy (object);
+ G_OBJECT_CLASS (panel_ditem_editor_parent_class)->dispose (object);
}
static void
panel_ditem_editor_class_init (PanelDItemEditorClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (class);
gobject_class->constructor = panel_ditem_editor_constructor;
gobject_class->get_property = panel_ditem_editor_get_property;
gobject_class->set_property = panel_ditem_editor_set_property;
-
- gtkobject_class->destroy = panel_ditem_editor_destroy;
+ gobject_class->dispose = panel_ditem_editor_dispose;
g_type_class_add_private (class,
sizeof (PanelDItemEditorPrivate));
@@ -608,8 +606,6 @@ panel_ditem_editor_make_ui (PanelDItemEditor *dialog)
dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 2);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
priv->table = gtk_table_new (4, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (priv->table), 5);
gtk_table_set_row_spacings (GTK_TABLE (priv->table), 6);
diff --git a/gnome-panel/panel-frame.c b/gnome-panel/panel-frame.c
index e140c82..91f8077 100644
--- a/gnome-panel/panel-frame.c
+++ b/gnome-panel/panel-frame.c
@@ -121,14 +121,15 @@ panel_frame_size_allocate (GtkWidget *widget,
}
void
-panel_frame_draw (GtkWidget *widget,
- PanelFrameEdge edges)
+panel_frame_draw (GtkWidget *widget,
+ cairo_t *cr,
+ PanelFrameEdge edges)
{
+ PanelFrame *frame = (PanelFrame *) widget;
GdkWindow *window;
GtkStyle *style;
GtkStateType state;
- GtkAllocation allocation;
- GdkGC *dark, *light, *black;
+ GdkColor *dark, *light, *black;
int x, y, width, height;
int xthickness, ythickness;
@@ -138,88 +139,101 @@ panel_frame_draw (GtkWidget *widget,
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
- gtk_widget_get_allocation (widget, &allocation);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
- dark = style->dark_gc [state];
- light = style->light_gc [state];
- black = style->black_gc;
+ dark = &style->dark [state];
+ light = &style->light [state];
+ black = &style->black;
xthickness = style->xthickness;
ythickness = style->ythickness;
- x = allocation.x;
- y = allocation.y;
- width = allocation.width;
- height = allocation.height;
-
/* Copied from gtk_default_draw_shadow() */
- if (edges & PANEL_EDGE_BOTTOM && ythickness > 0) {
+ x = y = 0;
+
+ cairo_set_line_width (cr, 1);
+
+ if (frame->edges & PANEL_EDGE_BOTTOM && ythickness > 0) {
if (ythickness > 1) {
- gdk_draw_line (window, dark,
- x, y + height - 2,
- x + width - 1, y + height - 2);
- gdk_draw_line (window, black,
- x, y + height - 1,
- x + width - 1, y + height - 1);
- } else
- gdk_draw_line (window, dark,
- x, y + height - 1,
- x + width - 1, y + height - 1);
+ gdk_cairo_set_source_color (cr, dark);
+ cairo_move_to (cr, x + .5, y + height - 2 + .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + height - 2 + .5);
+ cairo_stroke (cr);
+
+ gdk_cairo_set_source_color (cr, black);
+ cairo_move_to (cr, x + .5, y + height - 1 - .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+ } else {
+ gdk_cairo_set_source_color (cr, dark);
+ cairo_move_to (cr, x + .5, y + height - 1 - .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+ }
}
- if (edges & PANEL_EDGE_RIGHT && xthickness > 0) {
+ if (frame->edges & PANEL_EDGE_RIGHT && xthickness > 0) {
if (xthickness > 1) {
- gdk_draw_line (window, dark,
- x + width - 2, y,
- x + width - 2, y + height - 1);
-
- gdk_draw_line (window, black,
- x + width - 1, y,
- x + width - 1, y + height - 1);
- } else
- gdk_draw_line (window, dark,
- x + width - 1, y,
- x + width - 1, y + height - 1);
+ gdk_cairo_set_source_color (cr, dark);
+ cairo_move_to (cr, x + width - 2 - .5, y + .5);
+ cairo_line_to (cr, x + width - 2 - .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+
+ gdk_cairo_set_source_color (cr, black);
+ cairo_move_to (cr, x + width - 1 - .5, y + .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+ } else {
+ gdk_cairo_set_source_color (cr, dark);
+ cairo_move_to (cr, x + width - 1 - .5, y + .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+ }
}
- if (edges & PANEL_EDGE_TOP && ythickness > 0) {
- gdk_draw_line (window, light,
- x, y, x + width - 1, y);
+ if (frame->edges & PANEL_EDGE_TOP && ythickness > 0) {
+ gdk_cairo_set_source_color (cr, light);
+ cairo_move_to (cr, x + .5, y + .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + .5);
+ cairo_stroke (cr);
- if (ythickness > 1)
- gdk_draw_line (window,
- style->bg_gc [state],
- x, y + 1, x + width - 1, y + 1);
+ if (ythickness > 1) {
+ gdk_cairo_set_source_color (cr, &style->bg [state]);
+ cairo_move_to (cr, x + .5, y + 1 + .5);
+ cairo_line_to (cr, x + width - 1 - .5, y + 1 + .5);
+ cairo_stroke (cr);
+ }
}
- if (edges & PANEL_EDGE_LEFT && xthickness > 0) {
- gdk_draw_line (window, light,
- x, y, x, y + height - 1);
+ if (frame->edges & PANEL_EDGE_LEFT && xthickness > 0) {
+ gdk_cairo_set_source_color (cr, light);
+ cairo_move_to (cr, x + .5, y + .5);
+ cairo_line_to (cr, x + .5, y + height - 1 - .5);
+ cairo_stroke (cr);
- if (xthickness > 1)
- gdk_draw_line (window,
- style->bg_gc [state],
- x + 1, y, x + 1, y + height - 1);
+ if (xthickness > 1) {
+ gdk_cairo_set_source_color (cr, &style->bg [state]);
+ cairo_move_to (cr, x + 1 + .5, y + .5);
+ cairo_line_to (cr, x + 1 + .5, y + height - 1 - .5);
+ cairo_stroke (cr);
+ }
}
}
static gboolean
-panel_frame_expose (GtkWidget *widget,
- GdkEventExpose *event)
+panel_frame_real_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- PanelFrame *frame = (PanelFrame *) widget;
- gboolean retval = FALSE;
-
- if (!gtk_widget_is_drawable (widget))
- return retval;
+ gboolean retval = FALSE;
- if (GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event)
- retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event (widget, event);
+ if (GTK_WIDGET_CLASS (panel_frame_parent_class)->draw)
+ retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->draw (widget, cr);
- panel_frame_draw (widget, frame->edges);
+ panel_frame_draw (widget, cr, PANEL_FRAME (widget)->edges);
- return retval;
+ return retval;
}
static void
@@ -277,7 +291,7 @@ panel_frame_class_init (PanelFrameClass *klass)
widget_class->size_request = panel_frame_size_request;
widget_class->size_allocate = panel_frame_size_allocate;
- widget_class->expose_event = panel_frame_expose;
+ widget_class->draw = panel_frame_real_draw;
g_object_class_install_property (
gobject_class,
diff --git a/gnome-panel/panel-frame.h b/gnome-panel/panel-frame.h
index 99bf450..44bc2d8 100644
--- a/gnome-panel/panel-frame.h
+++ b/gnome-panel/panel-frame.h
@@ -58,6 +58,7 @@ void panel_frame_set_edges (PanelFrame *toplevel,
PanelFrameEdge panel_frame_get_edges (PanelFrame *toplevel);
void panel_frame_draw (GtkWidget *widget,
+ cairo_t *cr,
PanelFrameEdge edges);
G_END_DECLS
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index e004a9f..26be21a 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -305,20 +305,21 @@ panel_menu_bar_class_init (PanelMenuBarClass *klass)
}
static gboolean
-panel_menu_bar_on_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
+panel_menu_bar_on_draw (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
PanelMenuBar *menubar = data;
if (gtk_widget_has_focus (GTK_WIDGET (menubar)))
gtk_paint_focus (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
+ cr,
gtk_widget_get_state (GTK_WIDGET (menubar)),
- NULL,
widget,
"menubar-applet",
- 0, 0, -1, -1);
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
return FALSE;
}
@@ -363,8 +364,8 @@ panel_menu_bar_load (PanelWidget *panel,
G_CALLBACK (gtk_widget_queue_draw), menubar);
g_signal_connect_after (menubar, "focus-out-event",
G_CALLBACK (gtk_widget_queue_draw), menubar);
- g_signal_connect_after (menubar, "expose-event",
- G_CALLBACK (panel_menu_bar_on_expose), menubar);
+ g_signal_connect_after (menubar, "draw",
+ G_CALLBACK (panel_menu_bar_on_draw), menubar);
gtk_widget_set_can_focus (GTK_WIDGET (menubar), TRUE);
panel_widget_set_applet_expandable (panel, GTK_WIDGET (menubar), FALSE, TRUE);
@@ -440,10 +441,10 @@ panel_menu_bar_popup_menu (PanelMenuBar *menubar,
* As that function is private its code is replicated here.
*/
menu_shell = GTK_MENU_SHELL (menubar);
- if (!menu_shell->active) {
+ if (!menu_shell->GSEAL(active)) {
gtk_grab_add (GTK_WIDGET (menu_shell));
- menu_shell->have_grab = TRUE;
- menu_shell->active = TRUE;
+ menu_shell->GSEAL(have_grab) = TRUE;
+ menu_shell->GSEAL(active) = TRUE;
}
gtk_menu_shell_select_item (menu_shell,
gtk_menu_get_attach_widget (menu));
diff --git a/gnome-panel/panel-menu-button.c b/gnome-panel/panel-menu-button.c
index 2d93056..b02448e 100644
--- a/gnome-panel/panel-menu-button.c
+++ b/gnome-panel/panel-menu-button.c
@@ -349,7 +349,7 @@ panel_menu_button_menu_deactivated (PanelMenuButton *button)
{
panel_toplevel_pop_autohide_disabler (button->priv->toplevel);
- GTK_BUTTON (button)->in_button = FALSE;
+ GTK_BUTTON (button)->GSEAL(in_button) = FALSE;
button_widget_set_ignore_leave (BUTTON_WIDGET (button), FALSE);
}
diff --git a/gnome-panel/panel-profile.c b/gnome-panel/panel-profile.c
index c3de4f1..765b2b8 100644
--- a/gnome-panel/panel-profile.c
+++ b/gnome-panel/panel-profile.c
@@ -418,68 +418,50 @@ TOPLEVEL_IS_WRITABLE_FUNC ("background/type", background, type)
void
panel_profile_set_background_color (PanelToplevel *toplevel,
- PanelColor *color)
+ const GdkRGBA *color)
{
- panel_profile_set_background_gdk_color (toplevel, &color->gdk);
- panel_profile_set_background_opacity (toplevel, color->alpha);
-}
-
-void
-panel_profile_get_background_color (PanelToplevel *toplevel,
- PanelColor *color)
-{
- panel_profile_get_background_gdk_color (toplevel, &(color->gdk));
- color->alpha = panel_profile_get_background_opacity (toplevel);
-}
-
-TOPLEVEL_IS_WRITABLE_FUNC ("background/color", background, color)
+ GConfClient *client;
+ const char *key;
+ char *color_str;
-void
-panel_profile_set_background_gdk_color (PanelToplevel *toplevel,
- GdkColor *gdk_color)
-{
- GConfClient *client;
- const char *key;
- char *color_str;
+ client = panel_gconf_get_client ();
- client = panel_gconf_get_client ();
-
- color_str = g_strdup_printf ("#%02x%02x%02x",
- gdk_color->red / 256,
- gdk_color->green / 256,
- gdk_color->blue / 256);
+ color_str = gdk_rgba_to_string (color);
+ key = panel_profile_get_toplevel_key (toplevel, "background/color");
+ gconf_client_set_string (client, key, color_str, NULL);
- key = panel_profile_get_toplevel_key (toplevel, "background/color");
- gconf_client_set_string (client, key, color_str, NULL);
-
- g_free (color_str);
+ g_free (color_str);
}
void
-panel_profile_get_background_gdk_color (PanelToplevel *toplevel,
- GdkColor *gdk_color)
+panel_profile_get_background_color (PanelToplevel *toplevel,
+ GdkRGBA *color)
{
- GConfClient *client;
- const char *key;
- char *color_str;
+ GConfClient *client;
+ const char *key;
+ char *color_str;
- client = panel_gconf_get_client ();
+ client = panel_gconf_get_client ();
- key = panel_profile_get_toplevel_key (toplevel, "background/color");
- color_str = gconf_client_get_string (client, key, NULL);
- if (!color_str || !gdk_color_parse (color_str, gdk_color)) {
- gdk_color->red = 0;
- gdk_color->green = 0;
- gdk_color->blue = 0;
- }
+ key = panel_profile_get_toplevel_key (toplevel, "background/color");
+ color_str = gconf_client_get_string (client, key, NULL);
+ if (!color_str || !gdk_rgba_parse(color_str, color)) {
+ color->red = 0.;
+ color->green = 0.;
+ color->blue = 0.;
+ color->alpha = 0.;
+ }
- g_free (color_str);
+ g_free (color_str);
}
+TOPLEVEL_IS_WRITABLE_FUNC ("background/color", background, color)
+
void
panel_profile_set_background_opacity (PanelToplevel *toplevel,
guint16 opacity)
{
+#if 0
GConfClient *client;
const char *key;
@@ -487,11 +469,13 @@ panel_profile_set_background_opacity (PanelToplevel *toplevel,
key = panel_profile_get_toplevel_key (toplevel, "background/opacity");
gconf_client_set_int (client, key, opacity, NULL);
+#endif
}
guint16
panel_profile_get_background_opacity (PanelToplevel *toplevel)
{
+#if 0
GConfClient *client;
const char *key;
guint16 opacity;
@@ -502,6 +486,8 @@ panel_profile_get_background_opacity (PanelToplevel *toplevel)
opacity = gconf_client_get_int (client, key, NULL);
return opacity;
+#endif
+ return 0;
}
TOPLEVEL_IS_WRITABLE_FUNC ("background/opacity", background, opacity)
@@ -786,7 +772,7 @@ get_background_type (GConfClient *client,
static void
get_background_color (GConfClient *client,
const char *toplevel_dir,
- PanelColor *color)
+ GdkRGBA *color)
{
GError *error;
const char *key;
@@ -799,14 +785,16 @@ get_background_color (GConfClient *client,
g_warning (_("Error reading GConf string value '%s': %s"),
key, error->message);
g_error_free (error);
- } else if (!color_str || !gdk_color_parse (color_str, &(color->gdk))) {
- color->gdk.red = 0;
- color->gdk.green = 0;
- color->gdk.blue = 0;
+ } else if (!color_str || !gdk_rgba_parse (color_str, color)) {
+ color->red = 0.;
+ color->green = 0.;
+ color->blue = 0.;
+ color->alpha = 1.;
}
g_free (color_str);
+#if 0
error = NULL;
key = panel_gconf_sprintf ("%s/background/opacity", toplevel_dir);
color->alpha = gconf_client_get_int (client, key, &error);
@@ -816,6 +804,7 @@ get_background_color (GConfClient *client,
g_error_free (error);
color->alpha = 65535; /* fallback to fully opaque */
}
+#endif
}
static char *
@@ -857,7 +846,7 @@ panel_profile_load_background (PanelToplevel *toplevel,
PanelWidget *panel_widget;
PanelBackground *background;
PanelBackgroundType background_type;
- PanelColor color;
+ GdkRGBA color;
char *image;
gboolean fit;
gboolean stretch;
@@ -1235,18 +1224,20 @@ panel_profile_background_change_notify (GConfClient *client,
}
} else if (!strcmp (key, "color")) {
if (value->type == GCONF_VALUE_STRING) {
- GdkColor gdk_color;
+ GdkRGBA color;
const char *str;
str = gconf_value_get_string (value);
- if (gdk_color_parse (str, &gdk_color))
- panel_background_set_gdk_color (background, &gdk_color);
+ if (gdk_rgba_parse (str, &color))
+ panel_background_set_color (background, &color);
}
+#if 0
} else if (!strcmp (key, "opacity")) {
if (value->type == GCONF_VALUE_INT)
panel_background_set_opacity (background,
gconf_value_get_int (value));
+#endif
} else if (!strcmp (key, "image")) {
if (value->type == GCONF_VALUE_STRING)
panel_background_set_image (background,
diff --git a/gnome-panel/panel-profile.h b/gnome-panel/panel-profile.h
index f248930..767eded 100644
--- a/gnome-panel/panel-profile.h
+++ b/gnome-panel/panel-profile.h
@@ -116,16 +116,11 @@ PanelBackgroundType
gboolean panel_profile_is_writable_background_type (PanelToplevel *toplevel);
void panel_profile_set_background_color (PanelToplevel *toplevel,
- PanelColor *color);
+ const GdkRGBA *color);
void panel_profile_get_background_color (PanelToplevel *toplevel,
- PanelColor *color);
+ GdkRGBA *color);
gboolean panel_profile_is_writable_background_color (PanelToplevel *toplevel);
-void panel_profile_set_background_gdk_color (PanelToplevel *toplevel,
- GdkColor *gdk_color);
-void panel_profile_get_background_gdk_color (PanelToplevel *toplevel,
- GdkColor *gdk_color);
-
void panel_profile_set_background_opacity (PanelToplevel *toplevel,
guint16 opacity);
guint16 panel_profile_get_background_opacity (PanelToplevel *toplevel);
diff --git a/gnome-panel/panel-properties-dialog.c b/gnome-panel/panel-properties-dialog.c
index 4cab60c..7ecc275 100644
--- a/gnome-panel/panel-properties-dialog.c
+++ b/gnome-panel/panel-properties-dialog.c
@@ -316,19 +316,19 @@ static void
panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog,
GtkColorButton *color_button)
{
- GdkColor color;
+ GdkRGBA color;
g_assert (dialog->color_button == GTK_WIDGET (color_button));
- gtk_color_button_get_color (color_button, &color);
- panel_profile_set_background_gdk_color (dialog->toplevel, &color);
+ gtk_color_button_get_rgba (color_button, &color);
+ panel_profile_set_background_color (dialog->toplevel, &color);
}
static void
panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog,
GtkBuilder *gui)
{
- PanelColor color;
+ GdkRGBA color;
dialog->color_button = PANEL_GTK_BUILDER_GET (gui, "color_button");
g_return_if_fail (dialog->color_button != NULL);
@@ -337,8 +337,8 @@ panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog,
panel_profile_get_background_color (dialog->toplevel, &color);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (dialog->color_button),
- &(color.gdk));
+ gtk_color_button_set_rgba (GTK_COLOR_BUTTON (dialog->color_button),
+ &color);
g_signal_connect_swapped (dialog->color_button, "color_set",
G_CALLBACK (panel_properties_dialog_color_changed),
diff --git a/gnome-panel/panel-run-dialog.c b/gnome-panel/panel-run-dialog.c
index e525d49..94d17ef 100644
--- a/gnome-panel/panel-run-dialog.c
+++ b/gnome-panel/panel-run-dialog.c
@@ -149,7 +149,7 @@ _panel_run_get_recent_programs_list (void)
}
static void
-_panel_run_save_recent_programs_list (GtkComboBoxEntry *entry,
+_panel_run_save_recent_programs_list (GtkComboBox *entry,
char *lastcommand)
{
GtkTreeModel *model;
@@ -412,7 +412,7 @@ panel_run_dialog_execute (PanelRunDialog *dialog)
char *disk;
char *scheme;
- command = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
+ command = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox)))));
command = g_strchug (command);
if (!command || !command [0]) {
@@ -479,7 +479,7 @@ panel_run_dialog_execute (PanelRunDialog *dialog)
if (result) {
/* only save working commands in history */
_panel_run_save_recent_programs_list
- (GTK_COMBO_BOX_ENTRY (dialog->combobox), command);
+ (GTK_COMBO_BOX (dialog->combobox), command);
/* only close the dialog if we successfully showed or launched
* something */
@@ -538,7 +538,7 @@ static void
panel_run_dialog_append_file_utf8 (PanelRunDialog *dialog,
const char *file)
{
- char *text;
+ const char *text;
char *quoted, *temp;
GtkWidget *entry;
@@ -548,7 +548,7 @@ panel_run_dialog_append_file_utf8 (PanelRunDialog *dialog,
quoted = quote_string (file);
entry = gtk_bin_get_child (GTK_BIN (dialog->combobox));
- text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
if (text && text [0]) {
temp = g_strconcat (text, " ", quoted, NULL);
gtk_entry_set_text (GTK_ENTRY (entry), temp);
@@ -556,7 +556,6 @@ panel_run_dialog_append_file_utf8 (PanelRunDialog *dialog,
} else
gtk_entry_set_text (GTK_ENTRY (entry), quoted);
- g_free (text);
g_free (quoted);
}
@@ -664,7 +663,7 @@ panel_run_dialog_find_command_idle (PanelRunDialog *dialog)
return FALSE;
}
- text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox)))));
found_icon = NULL;
found_name = NULL;
fuzzy = FALSE;
@@ -1511,7 +1510,7 @@ entry_event (GtkEditable *entry,
return FALSE;
/* tab completion */
- if (event->keyval == GDK_Tab) {
+ if (event->keyval == GDK_KEY_Tab) {
gtk_editable_get_selection_bounds (entry, &pos, &tmp);
if (dialog->completion_started &&
@@ -1607,7 +1606,7 @@ combobox_changed (GtkComboBox *combobox,
char *start;
char *msg;
- text = gtk_combo_box_get_active_text (combobox);
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combobox)))));
start = text;
while (*start != '\0' && g_ascii_isspace (*start))
@@ -1751,8 +1750,8 @@ panel_run_dialog_setup_entry (PanelRunDialog *dialog,
gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->combobox),
_panel_run_get_recent_programs_list ());
- gtk_combo_box_entry_set_text_column
- (GTK_COMBO_BOX_ENTRY (dialog->combobox), 0);
+ gtk_combo_box_set_entry_text_column
+ (GTK_COMBO_BOX (dialog->combobox), 0);
screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));
@@ -1792,7 +1791,7 @@ panel_run_dialog_create_desktop_file (PanelRunDialog *dialog)
char *scheme;
char *save_uri;
- text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox)))));
if (!text || !text [0]) {
g_free (text);
diff --git a/gnome-panel/panel-run-dialog.ui b/gnome-panel/panel-run-dialog.ui
index d2bb2a8..04fa84f 100644
--- a/gnome-panel/panel-run-dialog.ui
+++ b/gnome-panel/panel-run-dialog.ui
@@ -58,8 +58,9 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkComboBoxEntry" id="comboboxentry">
+ <object class="GtkComboBoxText" id="comboboxentry">
<property name="visible">True</property>
+ <property name="has-entry">True</property>
</object>
<packing>
<property name="position">0</property>
diff --git a/gnome-panel/panel-separator.c b/gnome-panel/panel-separator.c
index 7d7f696..275c519 100644
--- a/gnome-panel/panel-separator.c
+++ b/gnome-panel/panel-separator.c
@@ -41,46 +41,37 @@ struct _PanelSeparatorPrivate {
G_DEFINE_TYPE (PanelSeparator, panel_separator, GTK_TYPE_EVENT_BOX)
-static void
-panel_separator_paint (GtkWidget *widget,
- GdkRectangle *area)
+static gboolean
+panel_separator_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- PanelSeparator *separator;
- GdkWindow *window;
- GtkStyle *style;
- GtkAllocation allocation;
+ PanelSeparator *separator = PANEL_SEPARATOR (widget);
+ GdkWindow *window;
+ GtkStyle *style;
+ int width, height;
- separator = PANEL_SEPARATOR (widget);
+ if (GTK_WIDGET_CLASS (panel_separator_parent_class)->draw)
+ GTK_WIDGET_CLASS (panel_separator_parent_class)->draw (widget, cr);
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
- gtk_widget_get_allocation (widget, &allocation);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
if (separator->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
- gtk_paint_vline (style, window,
+ gtk_paint_vline (style, cr,
gtk_widget_get_state (widget),
- area, widget, "separator",
+ widget, "separator",
style->xthickness,
- allocation.height - style->xthickness,
- (allocation.width - style->xthickness) / 2);
+ height - style->xthickness,
+ (width - style->xthickness) / 2);
} else {
- gtk_paint_hline (style, window,
+ gtk_paint_hline (style, cr,
gtk_widget_get_state (widget),
- area, widget, "separator",
+ widget, "separator",
style->ythickness,
- allocation.width - style->ythickness,
- (allocation.height - style->ythickness) / 2);
- }
-}
-
-static gboolean
-panel_separator_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- if (gtk_widget_is_drawable (widget)) {
- GTK_WIDGET_CLASS (panel_separator_parent_class)->expose_event (widget, event);
-
- panel_separator_paint (widget, &event->area);
+ width - style->ythickness,
+ (height - style->ythickness) / 2);
}
return FALSE;
@@ -158,7 +149,7 @@ panel_separator_class_init (PanelSeparatorClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->expose_event = panel_separator_expose_event;
+ widget_class->draw = panel_separator_draw;
widget_class->size_request = panel_separator_size_request;
widget_class->size_allocate = panel_separator_size_allocate;
widget_class->parent_set = panel_separator_parent_set;
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index c8d0e1c..6452ce7 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -851,20 +851,20 @@ panel_toplevel_warp_pointer_increment (PanelToplevel *toplevel,
gdk_window_get_pointer (root_window, &new_x, &new_y, NULL);
switch (keyval) {
- case GDK_Up:
- case GDK_KP_Up:
+ case GDK_KEY_Up:
+ case GDK_KEY_KP_Up:
new_y -= increment;
break;
- case GDK_Left:
- case GDK_KP_Left:
+ case GDK_KEY_Left:
+ case GDK_KEY_KP_Left:
new_x -= increment;
break;
- case GDK_Down:
- case GDK_KP_Down:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Down:
new_y += increment;
break;
- case GDK_Right:
- case GDK_KP_Right:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Right:
new_x += increment;
break;
default:
@@ -903,20 +903,20 @@ panel_toplevel_move_keyboard_expanded (PanelToplevel *toplevel,
PanelOrientation new_orientation;
switch (event->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
+ case GDK_KEY_Up:
+ case GDK_KEY_KP_Up:
new_orientation = PANEL_ORIENTATION_TOP;
break;
- case GDK_Left:
- case GDK_KP_Left:
+ case GDK_KEY_Left:
+ case GDK_KEY_KP_Left:
new_orientation = PANEL_ORIENTATION_LEFT;
break;
- case GDK_Down:
- case GDK_KP_Down:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Down:
new_orientation = PANEL_ORIENTATION_BOTTOM;
break;
- case GDK_Right:
- case GDK_KP_Right:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Right:
new_orientation = PANEL_ORIENTATION_RIGHT;
break;
default:
@@ -936,26 +936,26 @@ panel_toplevel_initial_resize_keypress (PanelToplevel *toplevel,
PanelGrabOpType grab_op;
switch (event->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
+ case GDK_KEY_Up:
+ case GDK_KEY_KP_Up:
if (!(toplevel->priv->orientation & PANEL_HORIZONTAL_MASK))
return FALSE;
grab_op = PANEL_GRAB_OP_RESIZE_UP;
break;
- case GDK_Left:
- case GDK_KP_Left:
+ case GDK_KEY_Left:
+ case GDK_KEY_KP_Left:
if (!(toplevel->priv->orientation & PANEL_VERTICAL_MASK))
return FALSE;
grab_op = PANEL_GRAB_OP_RESIZE_LEFT;
break;
- case GDK_Down:
- case GDK_KP_Down:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Down:
if (!(toplevel->priv->orientation & PANEL_HORIZONTAL_MASK))
return FALSE;
grab_op = PANEL_GRAB_OP_RESIZE_DOWN;
break;
- case GDK_Right:
- case GDK_KP_Right:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Right:
if (!(toplevel->priv->orientation & PANEL_VERTICAL_MASK))
return FALSE;
grab_op = PANEL_GRAB_OP_RESIZE_RIGHT;
@@ -978,14 +978,14 @@ panel_toplevel_handle_grab_op_key_event (PanelToplevel *toplevel,
gboolean retval = FALSE;
switch (event->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
- case GDK_Left:
- case GDK_KP_Left:
- case GDK_Down:
- case GDK_KP_Down:
- case GDK_Right:
- case GDK_KP_Right:
+ case GDK_KEY_Up:
+ case GDK_KEY_KP_Up:
+ case GDK_KEY_Left:
+ case GDK_KEY_KP_Left:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Down:
+ case GDK_KEY_Right:
+ case GDK_KEY_KP_Right:
switch (toplevel->priv->grab_op) {
case PANEL_GRAB_OP_MOVE:
if (toplevel->priv->expand)
@@ -1010,12 +1010,12 @@ panel_toplevel_handle_grab_op_key_event (PanelToplevel *toplevel,
break;
}
break;
- case GDK_Escape:
+ case GDK_KEY_Escape:
panel_toplevel_cancel_grab_op (toplevel, event->time);
- case GDK_Return: /* drop through*/
- case GDK_KP_Enter:
- case GDK_space:
- case GDK_KP_Space:
+ case GDK_KEY_Return: /* drop through*/
+ case GDK_KEY_KP_Enter:
+ case GDK_KEY_space:
+ case GDK_KEY_KP_Space:
panel_toplevel_end_grab_op (toplevel, event->time);
retval = TRUE;
default: /* drop through*/
@@ -3008,7 +3008,7 @@ panel_toplevel_unrealize (GtkWidget *widget)
}
static void
-panel_toplevel_destroy (GtkObject *widget)
+panel_toplevel_dispose (GObject *widget)
{
PanelToplevel *toplevel = (PanelToplevel *) widget;
@@ -3022,8 +3022,7 @@ panel_toplevel_destroy (GtkObject *widget)
panel_toplevel_disconnect_timeouts (toplevel);
- if (GTK_OBJECT_CLASS (panel_toplevel_parent_class)->destroy)
- GTK_OBJECT_CLASS (panel_toplevel_parent_class)->destroy (widget);
+ G_OBJECT_CLASS (panel_toplevel_parent_class)->dispose (widget);
}
static void
@@ -3167,8 +3166,8 @@ panel_toplevel_size_allocate (GtkWidget *widget,
}
static gboolean
-panel_toplevel_expose (GtkWidget *widget,
- GdkEventExpose *event)
+panel_toplevel_draw (GtkWidget *widget,
+ cairo_t *cr)
{
PanelToplevel *toplevel = (PanelToplevel *) widget;
PanelFrameEdge edges;
@@ -3176,16 +3175,14 @@ panel_toplevel_expose (GtkWidget *widget,
GdkWindow *window;
GtkStyle *style;
GtkStateType state;
- GtkAllocation allocation;
-
- if (!gtk_widget_is_drawable (widget))
- return retval;
+ int awidth, aheight;
- if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->expose_event)
- retval = GTK_WIDGET_CLASS (panel_toplevel_parent_class)->expose_event (widget, event);
+ if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->draw)
+ retval = GTK_WIDGET_CLASS (panel_toplevel_parent_class)->draw (widget, cr);
edges = toplevel->priv->edges;
- panel_frame_draw (widget, edges);
+ /* FIXMEchpe: WTF!? */
+ panel_frame_draw (widget, cr, edges);
if (toplevel->priv->expand ||
toplevel->priv->buttons_enabled ||
@@ -3195,16 +3192,17 @@ panel_toplevel_expose (GtkWidget *widget,
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
- gtk_widget_get_allocation (widget, &allocation);
+ awidth = gtk_widget_get_allocated_width (widget);
+ aheight = gtk_widget_get_allocated_height (widget);
if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) {
int x, y, width, height;
int xthickness, ythickness;
- x = allocation.x;
- y = allocation.y;
+ x = 0;
+ y = 0;
width = HANDLE_SIZE;
- height = allocation.height;
+ height = aheight;
xthickness = style->xthickness;
ythickness = style->ythickness;
@@ -3218,28 +3216,28 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_LEFT)
x += xthickness;
- gtk_paint_handle (style, window, state,
+ gtk_paint_handle (style, cr, state,
GTK_SHADOW_OUT,
- &event->area, widget, "handlebox",
+ widget, "handlebox",
x, y, width, height,
GTK_ORIENTATION_VERTICAL);
- x = allocation.width - HANDLE_SIZE;
+ x = awidth - HANDLE_SIZE;
if (edges & PANEL_EDGE_RIGHT)
x -= xthickness;
- gtk_paint_handle (style, window, state,
+ gtk_paint_handle (style, cr, state,
GTK_SHADOW_OUT,
- &event->area, widget, "handlebox",
+ widget, "handlebox",
x, y, width, height,
GTK_ORIENTATION_VERTICAL);
} else {
int x, y, width, height;
int xthickness, ythickness;
- x = allocation.x;
- y = allocation.y;
- width = allocation.width;
+ x = 0;
+ y = 0;
+ width = awidth;
height = HANDLE_SIZE;
xthickness = style->xthickness;
@@ -3254,19 +3252,19 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_TOP)
y += ythickness;
- gtk_paint_handle (style, window, state,
+ gtk_paint_handle (style, cr, state,
GTK_SHADOW_OUT,
- &event->area, widget, "handlebox",
+ widget, "handlebox",
x, y, width, height,
GTK_ORIENTATION_HORIZONTAL);
- y = allocation.height - HANDLE_SIZE;
+ y = aheight - HANDLE_SIZE;
if (edges & PANEL_EDGE_BOTTOM)
y -= ythickness;
- gtk_paint_handle (style, window, state,
+ gtk_paint_handle (style, cr, state,
GTK_SHADOW_OUT,
- &event->area, widget, "handlebox",
+ widget, "handlebox",
x, y, width, height,
GTK_ORIENTATION_HORIZONTAL);
}
@@ -4087,7 +4085,6 @@ static void
panel_toplevel_class_init (PanelToplevelClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
- GtkObjectClass *gtkobject_class = (GtkObjectClass *) klass;
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
GtkContainerClass *container_class = (GtkContainerClass *) klass;
GtkBindingSet *binding_set;
@@ -4096,15 +4093,14 @@ panel_toplevel_class_init (PanelToplevelClass *klass)
gobject_class->set_property = panel_toplevel_set_property;
gobject_class->get_property = panel_toplevel_get_property;
+ gobject_class->dispose = panel_toplevel_dispose;
gobject_class->finalize = panel_toplevel_finalize;
- gtkobject_class->destroy = panel_toplevel_destroy;
-
widget_class->realize = panel_toplevel_realize;
widget_class->unrealize = panel_toplevel_unrealize;
widget_class->size_request = panel_toplevel_size_request;
widget_class->size_allocate = panel_toplevel_size_allocate;
- widget_class->expose_event = panel_toplevel_expose;
+ widget_class->draw = panel_toplevel_draw;
widget_class->button_press_event = panel_toplevel_button_press_event;
widget_class->button_release_event = panel_toplevel_button_release_event;
widget_class->key_press_event = panel_toplevel_key_press_event;
@@ -4451,7 +4447,7 @@ panel_toplevel_class_init (PanelToplevelClass *klass)
G_TYPE_BOOLEAN,
0);
- gtk_binding_entry_add_signal (binding_set, GDK_F10, GDK_CONTROL_MASK,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_F10, GDK_CONTROL_MASK,
"popup_panel_menu", 0);
panel_bindings_set_entries (binding_set);
@@ -4617,6 +4613,9 @@ panel_toplevel_init (PanelToplevel *toplevel)
"delete-event",
G_CALLBACK (gtk_true),
NULL);
+
+ /* We don't want a resize grip on the panel */
+ gtk_window_set_has_resize_grip (GTK_WINDOW (toplevel), FALSE);
}
PanelWidget *
diff --git a/gnome-panel/panel-types.h b/gnome-panel/panel-types.h
index e71549a..044ebf7 100644
--- a/gnome-panel/panel-types.h
+++ b/gnome-panel/panel-types.h
@@ -11,9 +11,4 @@ typedef enum {
PANEL_SPEED_FAST
} PanelSpeed;
-typedef struct {
- GdkColor gdk;
- guint16 alpha;
-} PanelColor;
-
#endif
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index a594114..16cac99 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -67,7 +67,7 @@ static void panel_widget_cadd (GtkContainer *container,
GtkWidget *widget);
static void panel_widget_cremove (GtkContainer *container,
GtkWidget *widget);
-static void panel_widget_destroy (GtkObject *obj);
+static void panel_widget_dispose (GObject *obj);
static void panel_widget_finalize (GObject *obj);
static void panel_widget_realize (GtkWidget *widget);
static void panel_widget_unrealize (GtkWidget *panel);
@@ -125,10 +125,10 @@ add_tab_bindings (GtkBindingSet *binding_set,
GdkModifierType modifiers,
gboolean next)
{
- gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
"tab_move", 1,
G_TYPE_BOOLEAN, next);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
"tab_move", 1,
G_TYPE_BOOLEAN, next);
}
@@ -138,16 +138,16 @@ add_move_bindings (GtkBindingSet *binding_set,
GdkModifierType modifiers,
const gchar *name)
{
- gtk_binding_entry_add_signal (binding_set, GDK_Up, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, modifiers,
name, 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_UP);
- gtk_binding_entry_add_signal (binding_set, GDK_Down, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, modifiers,
name, 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_DOWN);
- gtk_binding_entry_add_signal (binding_set, GDK_Left, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, modifiers,
name, 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_LEFT);
- gtk_binding_entry_add_signal (binding_set, GDK_Right, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, modifiers,
name, 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_RIGHT);
}
@@ -172,19 +172,19 @@ add_all_move_bindings (PanelWidget *panel)
add_tab_bindings (binding_set, GDK_SHIFT_MASK, FALSE);
gtk_binding_entry_add_signal (binding_set,
- GDK_Escape, 0,
+ GDK_KEY_Escape, 0,
"end_move", 0);
gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Enter, 0,
+ GDK_KEY_KP_Enter, 0,
"end_move", 0);
gtk_binding_entry_add_signal (binding_set,
- GDK_Return, 0,
+ GDK_KEY_Return, 0,
"end_move", 0);
gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Space, 0,
+ GDK_KEY_KP_Space, 0,
"end_move", 0);
gtk_binding_entry_add_signal (binding_set,
- GDK_space, 0,
+ GDK_KEY_space, 0,
"end_move", 0);
focus_widget = gtk_window_get_focus (GTK_WINDOW (panel->toplevel));
@@ -231,18 +231,18 @@ remove_tab_bindings (GtkBindingSet *binding_set,
GdkModifierType modifiers,
gboolean next)
{
- gtk_binding_entry_remove (binding_set, GDK_Tab, modifiers);
- gtk_binding_entry_remove (binding_set, GDK_KP_Tab, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Tab, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_KP_Tab, modifiers);
}
static void
remove_move_bindings (GtkBindingSet *binding_set,
GdkModifierType modifiers)
{
- gtk_binding_entry_remove (binding_set, GDK_Up, modifiers);
- gtk_binding_entry_remove (binding_set, GDK_Down, modifiers);
- gtk_binding_entry_remove (binding_set, GDK_Left, modifiers);
- gtk_binding_entry_remove (binding_set, GDK_Right, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Up, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Down, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Left, modifiers);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Right, modifiers);
}
static void
@@ -264,18 +264,17 @@ remove_all_move_bindings (PanelWidget *panel)
remove_tab_bindings (binding_set, 0, TRUE);
remove_tab_bindings (binding_set, GDK_SHIFT_MASK, FALSE);
- gtk_binding_entry_remove (binding_set, GDK_Escape, 0);
- gtk_binding_entry_remove (binding_set, GDK_KP_Enter, 0);
- gtk_binding_entry_remove (binding_set, GDK_Return, 0);
- gtk_binding_entry_remove (binding_set, GDK_KP_Space, 0);
- gtk_binding_entry_remove (binding_set, GDK_space, 0);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Escape, 0);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_KP_Enter, 0);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_Return, 0);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_KP_Space, 0);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_space, 0);
}
static void
panel_widget_class_init (PanelWidgetClass *class)
{
- GtkObjectClass *object_class = (GtkObjectClass*) class;
- GObjectClass *gobject_class = (GObjectClass*) class;
+ GObjectClass *object_class = (GObjectClass*) class;
GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
GtkContainerClass *container_class = (GtkContainerClass*) class;
@@ -407,8 +406,8 @@ panel_widget_class_init (PanelWidgetClass *class)
class->tab_move = panel_widget_tab_move;
class->end_move = panel_widget_end_move;
- object_class->destroy = panel_widget_destroy;
- gobject_class->finalize = panel_widget_finalize;
+ object_class->dispose = panel_widget_dispose;
+ object_class->finalize = panel_widget_finalize;
widget_class->size_request = panel_widget_size_request;
widget_class->size_allocate = panel_widget_size_allocate;
@@ -1568,7 +1567,7 @@ panel_widget_style_set (GtkWidget *widget,
panel_background_set_default_style (
&PANEL_WIDGET (widget)->background,
&style->bg [state],
- style->bg_pixmap [state]);
+ style->background [state]);
}
}
@@ -1586,7 +1585,7 @@ panel_widget_state_changed (GtkWidget *widget,
panel_background_set_default_style (
&PANEL_WIDGET (widget)->background,
&style->bg [state],
- style->bg_pixmap [state]);
+ style->background [state]);
}
}
@@ -1624,7 +1623,7 @@ panel_widget_realize (GtkWidget *widget)
panel_background_set_default_style (
&panel->background,
&style->bg [state],
- style->bg_pixmap [state]);
+ style->background [state]);
panel_background_realized (&panel->background, window);
}
@@ -1694,13 +1693,9 @@ panel_widget_destroy_open_dialogs (PanelWidget *panel_widget)
}
static void
-panel_widget_destroy (GtkObject *obj)
+panel_widget_dispose (GObject *obj)
{
- PanelWidget *panel;
-
- g_return_if_fail (PANEL_IS_WIDGET (obj));
-
- panel = PANEL_WIDGET (obj);
+ PanelWidget *panel = PANEL_WIDGET (obj);
panels = g_slist_remove (panels, panel);
@@ -1715,8 +1710,7 @@ panel_widget_destroy (GtkObject *obj)
panel->master_widget = NULL;
}
- if (GTK_OBJECT_CLASS (panel_widget_parent_class)->destroy)
- GTK_OBJECT_CLASS (panel_widget_parent_class)->destroy (obj);
+ G_OBJECT_CLASS (panel_widget_parent_class)->dispose (obj);
}
static void
@@ -2329,7 +2323,7 @@ panel_widget_applet_key_press_event (GtkWidget *widget,
if (!panel_applet_in_drag)
return FALSE;
- return gtk_bindings_activate (GTK_OBJECT (panel),
+ return gtk_bindings_activate (G_OBJECT (panel),
((GdkEventKey *)event)->keyval,
((GdkEventKey *)event)->state);
}
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index b6f3631..162ce38 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -392,9 +392,9 @@ panel_key_press_event (GtkWidget *widget,
* activating the key bindings here.
*/
if (GTK_IS_SOCKET (gtk_window_get_focus (GTK_WINDOW (widget))) &&
- event->keyval == GDK_F10 &&
+ event->keyval == GDK_KEY_F10 &&
(event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK)
- return gtk_bindings_activate (GTK_OBJECT (widget),
+ return gtk_bindings_activate (G_OBJECT (widget),
event->keyval,
event->state);
@@ -426,7 +426,7 @@ static gboolean
set_background_color (PanelToplevel *toplevel,
guint16 *dropped)
{
- PanelColor color;
+ GdkRGBA color;
if (!dropped)
return FALSE;
@@ -435,10 +435,10 @@ set_background_color (PanelToplevel *toplevel,
! panel_profile_is_writable_background_color (toplevel))
return FALSE;
- color.gdk.red = dropped [0];
- color.gdk.green = dropped [1];
- color.gdk.blue = dropped [2];
- color.alpha = 65535;
+ color.red = dropped [0] / 65535.;
+ color.green = dropped [1] / 65535.;
+ color.blue = dropped [2] / 65535.;
+ color.alpha = 1.;
panel_profile_set_background_color (toplevel, &color);
panel_profile_set_background_type (toplevel, PANEL_BACK_COLOR);
diff --git a/gnome-panel/xstuff.c b/gnome-panel/xstuff.c
index 0ba272a..db7354d 100644
--- a/gnome-panel/xstuff.c
+++ b/gnome-panel/xstuff.c
@@ -223,8 +223,7 @@ xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h)
gdk_window_move_resize (window, x, y, w, h);
- gdk_flush ();
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
g_object_set_data (G_OBJECT (window), "xstuff-cached-x", GINT_TO_POINTER (x));
g_object_set_data (G_OBJECT (window), "xstuff-cached-y", GINT_TO_POINTER (y));
@@ -313,9 +312,9 @@ zoom_timeout (GtkWidget *window)
}
static gboolean
-zoom_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer user_data)
+zoom_draw (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer user_data)
{
CompositedZoomData *zoom;
@@ -336,7 +335,6 @@ zoom_expose (GtkWidget *widget,
GdkPixbuf *scaled;
int width, height;
int x = 0, y = 0;
- cairo_t *cr;
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
@@ -370,7 +368,6 @@ zoom_expose (GtkWidget *widget,
}
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_rgba (cr, 0, 0, 0, 0.0);
cairo_rectangle (cr, 0, 0, width, height);
@@ -380,7 +377,6 @@ zoom_expose (GtkWidget *widget,
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_paint_with_alpha (cr, MAX (zoom->opacity, 0));
- cairo_destroy (cr);
g_object_unref (scaled);
}
@@ -415,7 +411,7 @@ draw_zoom_animation_composited (GdkScreen *gscreen,
gtk_window_set_keep_above (GTK_WINDOW (win), TRUE);
gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
gtk_widget_set_app_paintable(win, TRUE);
- gtk_widget_set_colormap (win, gdk_screen_get_rgba_colormap (gscreen));
+ gtk_widget_set_visual (win, gdk_screen_get_rgba_visual (gscreen));
gtk_window_set_gravity (GTK_WINDOW (win), GDK_GRAVITY_STATIC);
gtk_window_set_default_size (GTK_WINDOW (win),
@@ -445,12 +441,12 @@ draw_zoom_animation_composited (GdkScreen *gscreen,
gtk_window_move (GTK_WINDOW (win), wx, wy);
- g_signal_connect (G_OBJECT (win), "expose-event",
- G_CALLBACK (zoom_expose), zoom);
+ g_signal_connect (G_OBJECT (win), "draw",
+ G_CALLBACK (zoom_draw), zoom);
/* see doc for gtk_widget_set_app_paintable() */
gtk_widget_realize (win);
- gdk_window_set_back_pixmap (gtk_widget_get_window (win), NULL, FALSE);
+ gdk_window_set_background_pattern (gtk_widget_get_window (win), NULL);
gtk_widget_show (win);
zoom->timeout_id = g_timeout_add (ZOOM_DELAY,
@@ -480,11 +476,9 @@ draw_zoom_animation (GdkScreen *gscreen,
dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen));
root_win = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (gscreen));
screen = gdk_screen_get_number (gscreen);
- depth = gdk_drawable_get_depth (gdk_screen_get_root_window (gscreen));
+ depth = DefaultDepth(dpy,screen);
/* frame GC */
- gdk_colormap_alloc_color (
- gdk_screen_get_system_colormap (gscreen), &color, FALSE, TRUE);
gcv.function = GXxor;
/* this will raise the probability of the XORed color being different
* of the original color in PseudoColor when not all color cells are
@@ -575,9 +569,6 @@ draw_zoom_animation (GdkScreen *gscreen,
XUngrabServer(dpy);
XFreeGC (dpy, frame_gc);
- gdk_colormap_free_colors (gdk_screen_get_system_colormap (gscreen),
- &color, 1);
-
}
#undef FRAMES
diff --git a/libpanel-applet/Makefile.am b/libpanel-applet/Makefile.am
index 7a07a8a..df29704 100644
--- a/libpanel-applet/Makefile.am
+++ b/libpanel-applet/Makefile.am
@@ -1,4 +1,4 @@
-lib_LTLIBRARIES = libpanel-applet-3.la
+lib_LTLIBRARIES = libpanel-applet-4.la
noinst_PROGRAMS = test-dbus-applet
AM_CPPFLAGS = \
@@ -9,13 +9,13 @@ AM_CPPFLAGS = \
AM_CFLAGS = $(WARN_CFLAGS)
-libpanel_appletincludedir = $(includedir)/gnome-panel-3.0/libpanel-applet
+libpanel_appletincludedir = $(includedir)/gnome-panel-4.0/libpanel-applet
libpanel_appletinclude_HEADERS = \
panel-applet.h \
panel-applet-gconf.h \
panel-applet-enums.h
-libpanel_applet_3_la_SOURCES = \
+libpanel_applet_4_la_SOURCES = \
$(BUILT_SOURCES) \
panel-applet.h \
panel-applet.c \
@@ -24,19 +24,19 @@ libpanel_applet_3_la_SOURCES = \
panel-applet-gconf.c \
panel-applet-gconf.h
-libpanel_applet_3_la_LIBADD = \
+libpanel_applet_4_la_LIBADD = \
$(LIBPANEL_APPLET_LIBS) \
$(X_LIBS)
-libpanel_applet_3_la_LDFLAGS = \
+libpanel_applet_4_la_LDFLAGS = \
-version-info $(LIB_PANEL_APPLET_LT_VERSION) \
-no-undefined
test_dbus_applet_LDADD = \
$(LIBPANEL_APPLET_LIBS) \
- libpanel-applet-3.la
+ libpanel-applet-4.la
-$(libpanel_applet_3_la_OBJECTS) $(test_dbus_applet_OBJECTS): $(BUILT_SOURCES)
+$(libpanel_applet_4_la_OBJECTS) $(test_dbus_applet_OBJECTS): $(BUILT_SOURCES)
panel-applet-marshal.h: panel-applet-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN)$(GLIB_GENMARSHAL) $< --header --prefix=panel_applet_marshal > $@
@@ -82,7 +82,7 @@ BUILT_SOURCES = \
panel-applet-marshal.h
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libpanelapplet-3.0.pc
+pkgconfig_DATA = libpanelapplet-4.0.pc
appletdir = $(datadir)/gnome-panel/applets
applet_in_files = org.gnome.panel.TestApplet.panel-applet.in
@@ -93,8 +93,8 @@ noinst_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
EXTRA_DIST = \
org.gnome.panel.TestApplet.panel-applet.in \
panel-applet-marshal.list \
- libpanelapplet-3.0.pc.in \
- libpanelapplet-3.0-uninstalled.pc.in
+ libpanelapplet-4.0.pc.in \
+ libpanelapplet-4.0-uninstalled.pc.in
CLEANFILES = $(BUILT_SOURCES) $(noinst_DATA)
@@ -116,15 +116,15 @@ built_introspection_sources = \
panel-applet-enums.c \
panel-applet-enums.h
-PanelApplet-3.0.gir: libpanel-applet-3.la
-PanelApplet_3_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 GConf-2.0
-PanelApplet_3_0_gir_CFLAGS = $(AM_CPPFLAGS)
-PanelApplet_3_0_gir_LIBS = libpanel-applet-3.la
-PanelApplet_3_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources)) $(addprefix $(builddir)/,$(built_introspection_sources))
+PanelApplet-4.0.gir: libpanel-applet-4.la
+PanelApplet_4_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 GConf-2.0
+PanelApplet_4_0_gir_CFLAGS = $(AM_CPPFLAGS)
+PanelApplet_4_0_gir_LIBS = libpanel-applet-4.la
+PanelApplet_4_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources)) $(addprefix $(builddir)/,$(built_introspection_sources))
# When requiring gobject-introspection 0.9.5, use this:
-#PanelApplet_3_0_gir_SCANNERFLAGS = --identifier-prefix=Panel --symbol-prefix=panel --pkg-export=libpanelapplet-3.0
-PanelApplet_3_0_gir_SCANNERFLAGS = --strip-prefix=Panel --pkg-export=libpanelapplet-3.0
-INTROSPECTION_GIRS += PanelApplet-3.0.gir
+#PanelApplet_4_0_gir_SCANNERFLAGS = --identifier-prefix=Panel --symbol-prefix=panel --pkg-export=libpanelapplet-4.0
+PanelApplet_4_0_gir_SCANNERFLAGS = --strip-prefix=Panel --pkg-export=libpanelapplet-4.0
+INTROSPECTION_GIRS += PanelApplet-4.0.gir
girdir = $(INTROSPECTION_GIRDIR)
gir_DATA = $(INTROSPECTION_GIRS)
diff --git a/libpanel-applet/libpanelapplet-3.0-uninstalled.pc.in b/libpanel-applet/libpanelapplet-uninstalled.pc.in
similarity index 61%
rename from libpanel-applet/libpanelapplet-3.0-uninstalled.pc.in
rename to libpanel-applet/libpanelapplet-uninstalled.pc.in
index 10c49e3..d3b5c77 100644
--- a/libpanel-applet/libpanelapplet-3.0-uninstalled.pc.in
+++ b/libpanel-applet/libpanelapplet-uninstalled.pc.in
@@ -3,9 +3,9 @@ exec_prefix= exec_prefix@
libdir= libdir@
includedir= includedir@
-Name: libpanel-applet-3
-Description: libpanel-applet-3
+Name: libpanel-applet-4
+Description: libpanel-applet-4
Requires: glib-2.0 gconf-2.0 gtk+-3.0
Version: @VERSION@
-Libs: ${pc_top_builddir}/${pcfiledir}/libpanel-applet-3.la
+Libs: ${pc_top_builddir}/${pcfiledir}/libpanel-applet-4.la
Cflags: -I${pc_top_builddir}/${pcfiledir}
diff --git a/libpanel-applet/libpanelapplet.pc.in b/libpanel-applet/libpanelapplet.pc.in
new file mode 100644
index 0000000..1f86015
--- /dev/null
+++ b/libpanel-applet/libpanelapplet.pc.in
@@ -0,0 +1,11 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: libpanel-applet-4
+Description: libpanel-applet-4
+Requires: glib-2.0 gconf-2.0 gtk+-3.0
+Version: @VERSION@
+Libs: -L${libdir} -lpanel-applet-4
+Cflags: -I${includedir}/gnome-panel-4.0/libpanel-applet
diff --git a/libpanel-applet/panel-applet-marshal.list b/libpanel-applet/panel-applet-marshal.list
index 1693a57..dcf07d3 100644
--- a/libpanel-applet/panel-applet-marshal.list
+++ b/libpanel-applet/panel-applet-marshal.list
@@ -1,5 +1 @@
-VOID:ENUM,BOXED,OBJECT
-VOID:INT
-VOID:UINT
-VOID:ENUM
BOOLEAN:STRING
diff --git a/libpanel-applet/panel-applet.c b/libpanel-applet/panel-applet.c
index 5b63561..714ac9f 100644
--- a/libpanel-applet/panel-applet.c
+++ b/libpanel-applet/panel-applet.c
@@ -30,9 +30,11 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <glib/gi18n-lib.h>
#include <cairo.h>
+#include <cairo-gobject.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
@@ -40,6 +42,7 @@
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#include <X11/Xatom.h>
+#include <cairo-xlib.h>
#include "panel-applet.h"
#include "panel-applet-factory.h"
@@ -1071,7 +1074,7 @@ panel_applet_button_event (GtkWidget *widget,
xevent.xbutton.display = GDK_WINDOW_XDISPLAY (window);
xevent.xbutton.window = GDK_WINDOW_XWINDOW (socket_window);
xevent.xbutton.root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window
- (gdk_drawable_get_screen (window)));
+ (gdk_window_get_screen (window)));
/*
* FIXME: the following might cause
* big problems for non-GTK apps
@@ -1090,8 +1093,7 @@ panel_applet_button_event (GtkWidget *widget,
GDK_WINDOW_XWINDOW (socket_window),
False, NoEventMask, &xevent);
- gdk_flush ();
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
return TRUE;
}
@@ -1218,24 +1220,20 @@ panel_applet_size_allocate (GtkWidget *widget,
}
static gboolean
-panel_applet_expose (GtkWidget *widget,
- GdkEventExpose *event)
+panel_applet_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- GtkAllocation allocation;
int border_width;
int focus_width = 0;
int x, y, width, height;
- g_return_val_if_fail (PANEL_IS_APPLET (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_CLASS (panel_applet_parent_class)->expose_event (widget,
- event);
+ GTK_WIDGET_CLASS (panel_applet_parent_class)->draw (widget, cr);
if (!gtk_widget_has_focus (widget))
return FALSE;
- gtk_widget_get_allocation (widget, &allocation);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
/*
* We are deliberately ignoring focus-padding here to
@@ -1247,16 +1245,15 @@ panel_applet_expose (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- x = allocation.x;
- y = allocation.y;
-
- width = allocation.width - 2 * border_width;
- height = allocation.height - 2 * border_width;
+ x = 0; // FIXME: border_width ?
+ y = 0; // FIXME: border_width ?
+ width -= 2 * border_width;
+ height -= 2 * border_width;
gtk_paint_focus (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
+ cr,
gtk_widget_get_state (widget),
- &event->area, widget, "panel_applet",
+ widget, "panel_applet",
x, y, width, height);
return FALSE;
@@ -1311,28 +1308,10 @@ panel_applet_focus (GtkWidget *widget,
}
static gboolean
-panel_applet_parse_color (const gchar *color_str,
- GdkColor *color)
-{
- int r, g, b;
-
- g_assert (color_str && color);
-
- if (sscanf (color_str, "%4x%4x%4x", &r, &g, &b) != 3)
- return FALSE;
-
- color->red = r;
- color->green = g;
- color->blue = b;
-
- return TRUE;
-}
-
-static gboolean
panel_applet_parse_pixmap_str (const char *str,
- GdkNativeWindow *xid,
- int *x,
- int *y)
+ XID *xid,
+ int *x,
+ int *y)
{
char **elements;
char *tmp;
@@ -1352,16 +1331,22 @@ panel_applet_parse_pixmap_str (const char *str,
!elements [2] || !*elements [2])
goto ERROR_AND_FREE;
- *xid = strtol (elements [0], &tmp, 10);
- if (tmp == elements [0])
+ errno = 0;
+ tmp = NULL;
+ *xid = g_ascii_strtoll (elements [0], &tmp, 10);
+ if (errno || tmp == elements [0])
goto ERROR_AND_FREE;
- *x = strtol (elements [1], &tmp, 10);
- if (tmp == elements [1])
+ errno = 0;
+ tmp = NULL;
+ *x = g_ascii_strtoll (elements [1], &tmp, 10);
+ if (errno || tmp == elements [1])
goto ERROR_AND_FREE;
- *y = strtol (elements [2], &tmp, 10);
- if (tmp == elements [2])
+ errno = 0;
+ tmp = NULL;
+ *y = g_ascii_strtoll (elements [2], &tmp, 10);
+ if (errno || tmp == elements [2])
goto ERROR_AND_FREE;
g_strfreev (elements);
@@ -1372,148 +1357,111 @@ panel_applet_parse_pixmap_str (const char *str,
return FALSE;
}
-static GdkPixmap *
-panel_applet_get_pixmap (PanelApplet *applet,
- GdkNativeWindow xid,
- int x,
- int y)
+static cairo_pattern_t *
+panel_applet_get_pixmap (PanelApplet *applet,
+ XID xid,
+ int x,
+ int y)
{
- gboolean display_grabbed;
- GdkPixmap *pixmap;
GdkDisplay *display;
- GdkPixmap *retval;
+ GdkVisual *visual;
GdkWindow *window;
int width;
int height;
- cairo_t *cr;
- cairo_pattern_t *pattern;
+ cairo_surface_t *surface;
+ cairo_matrix_t matrix;
+ cairo_pattern_t *pattern;
g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL);
if (!gtk_widget_get_realized (GTK_WIDGET (applet)))
return NULL;
- display = gdk_display_get_default ();
- display_grabbed = FALSE;
+ window = gtk_widget_get_window (GTK_WIDGET (applet));
- window = gtk_widget_get_window (GTK_WIDGET (applet));
+ display = gdk_window_get_display (window);
+ visual = gdk_window_get_visual (window);
+ width = gdk_window_get_width (window);
+ height = gdk_window_get_height (window);
- pixmap = gdk_pixmap_lookup_for_display (display, xid);
- if (pixmap)
- g_object_ref (pixmap);
- else {
- display_grabbed = TRUE;
- gdk_x11_display_grab (display);
- pixmap = gdk_pixmap_foreign_new_for_display (display, xid);
- }
-
- /* This can happen if the user changes the background very fast.
- * We'll get the next update, so it's not a big deal. */
- if (pixmap == NULL) {
- if (display_grabbed)
- gdk_x11_display_ungrab (display);
- return NULL;
- }
+ gdk_error_trap_push ();
+ surface = cairo_xlib_surface_create (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ gdk_x11_visual_get_xvisual (visual),
+ width, height);
+ gdk_error_trap_pop_ignored ();
+ if (cairo_surface_status (surface))
+ return NULL;
- gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
- retval = gdk_pixmap_new (window, width, height, -1);
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_surface_destroy (surface);
- /* the pixmap has no colormap, and we need one */
- gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap),
- gdk_drawable_get_colormap (window));
-
- cr = gdk_cairo_create (GDK_DRAWABLE (retval));
- gdk_cairo_set_source_pixmap (cr, pixmap, -x, -y);
- pattern = cairo_get_source (cr);
+ cairo_matrix_init_translate (&matrix, -x, -y);
+ cairo_pattern_set_matrix (pattern, &matrix);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-
- g_object_unref (pixmap);
-
- if (display_grabbed)
- gdk_x11_display_ungrab (display);
-
- return retval;
+ return pattern;
}
-static PanelAppletBackgroundType
-panel_applet_handle_background_string (PanelApplet *applet,
- GdkColor *color,
- GdkPixmap **pixmap)
+/**
+ * panel_applet_get_background:
+ * @applet: a #PanelApplet
+ *
+ * Returns the background pattern for @applet, or %NULL if there is none.
+ *
+ * Returns: (transfer full): a new #cairo_pattern_t
+ */
+cairo_pattern_t *
+panel_applet_get_background (PanelApplet *applet)
{
- PanelAppletBackgroundType retval;
- char **elements;
+ cairo_pattern_t *pattern = NULL;
+ char **elements;
- retval = PANEL_NO_BACKGROUND;
+ g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL);
if (!gtk_widget_get_realized (GTK_WIDGET (applet)) || !applet->priv->background)
- return retval;
+ return NULL;
elements = g_strsplit (applet->priv->background, ":", -1);
+ if (elements == NULL)
+ return NULL;
if (elements [0] && !strcmp (elements [0], "none" )) {
- retval = PANEL_NO_BACKGROUND;
+ pattern = NULL;
} else if (elements [0] && !strcmp (elements [0], "color")) {
- g_return_val_if_fail (color != NULL, PANEL_NO_BACKGROUND);
+ GdkRGBA color;
- if (!elements [1] || !panel_applet_parse_color (elements [1], color)) {
+ if (!elements [1] || !gdk_rgba_parse (elements [1], &color)) {
g_warning ("Incomplete '%s' background type received", elements [0]);
- g_strfreev (elements);
- return PANEL_NO_BACKGROUND;
+ goto out;
}
- retval = PANEL_COLOR_BACKGROUND;
-
+ pattern = cairo_pattern_create_rgba (color.red, color.green, color.blue, color.alpha);
} else if (elements [0] && !strcmp (elements [0], "pixmap")) {
- GdkNativeWindow pixmap_id;
- int x, y;
+ XID xid;
+ int x, y;
- g_return_val_if_fail (pixmap != NULL, PANEL_NO_BACKGROUND);
-
- if (!panel_applet_parse_pixmap_str (elements [1], &pixmap_id, &x, &y)) {
+ if (!panel_applet_parse_pixmap_str (elements [1], &xid, &x, &y)) {
g_warning ("Incomplete '%s' background type received: %s",
elements [0], elements [1]);
-
- g_strfreev (elements);
- return PANEL_NO_BACKGROUND;
+ goto out;
}
- *pixmap = panel_applet_get_pixmap (applet, pixmap_id, x, y);
- if (!*pixmap) {
+ pattern = panel_applet_get_pixmap (applet, xid, x, y);
+ if (!pattern) {
g_warning ("Failed to get pixmap %s", elements [1]);
- g_strfreev (elements);
- return PANEL_NO_BACKGROUND;
+ goto out;
}
-
- retval = PANEL_PIXMAP_BACKGROUND;
- } else
+ } else {
g_warning ("Unknown background type received");
+ }
+ out:
g_strfreev (elements);
- return retval;
-}
-
-PanelAppletBackgroundType
-panel_applet_get_background (PanelApplet *applet,
- GdkColor *color,
- GdkPixmap **pixmap)
-{
- g_return_val_if_fail (PANEL_IS_APPLET (applet), PANEL_NO_BACKGROUND);
-
- /* initial sanity */
- if (pixmap != NULL)
- *pixmap = NULL;
- if (color != NULL)
- memset (color, 0, sizeof (GdkColor));
-
- return panel_applet_handle_background_string (applet, color, pixmap);
+ return pattern;
}
static void
@@ -1534,11 +1482,17 @@ panel_applet_set_background_string (PanelApplet *applet,
g_object_notify (G_OBJECT (applet), "background");
}
+static gboolean
+matrix_is_identity (cairo_matrix_t *matrix)
+{
+ return matrix->xx == 1.0 && matrix->yy == 1.0 &&
+ matrix->yx == 0.0 && matrix->xy == 0.0 &&
+ matrix->x0 == 0.0 && matrix->y0 == 0.0;
+}
+
static void
-panel_applet_update_background_for_widget (GtkWidget *widget,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap)
+panel_applet_update_background_for_widget (GtkWidget *widget,
+ cairo_pattern_t *pattern)
{
GtkRcStyle *rc_style;
GtkStyle *style;
@@ -1549,22 +1503,46 @@ panel_applet_update_background_for_widget (GtkWidget *widget,
gtk_widget_modify_style (widget, rc_style);
g_object_unref (rc_style);
- switch (type) {
- case PANEL_NO_BACKGROUND:
+ if (pattern == NULL) {
+ return;
+ }
+
+ switch (cairo_pattern_get_type (pattern)) {
+ case CAIRO_PATTERN_TYPE_SOLID: {
+ double r, b, g, a;
+ GdkColor color;
+
+ cairo_pattern_get_rgba (pattern, &r, &g, &b, &a);
+ color.pixel = 0;
+ color.red = r * 65535.;
+ color.green = g * 65535.;
+ color.blue = b * 65535.;
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color);
break;
- case PANEL_COLOR_BACKGROUND:
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
- break;
- case PANEL_PIXMAP_BACKGROUND:
- style = gtk_style_copy (gtk_widget_get_style (widget));
- if (style->bg_pixmap[GTK_STATE_NORMAL])
- g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
- style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
- gtk_widget_set_style (widget, style);
- g_object_unref (style);
+ }
+ case CAIRO_PATTERN_TYPE_SURFACE: {
+ cairo_surface_t *surface;
+ cairo_matrix_t matrix;
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ cairo_pattern_get_matrix (pattern, &matrix);
+ if (cairo_pattern_get_surface (pattern, &surface) == CAIRO_STATUS_SUCCESS &&
+ matrix_is_identity (&matrix) &&
+ cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB &&
+ cairo_xlib_surface_get_visual (surface) == GDK_VISUAL_XVISUAL (gdk_window_get_visual ((window))) &&
+ cairo_xlib_surface_get_display (surface) == GDK_WINDOW_XDISPLAY (window)) {
+ style = gtk_style_copy (gtk_widget_get_style (widget));
+ if (style->background[GTK_STATE_NORMAL])
+ cairo_pattern_destroy (style->background[GTK_STATE_NORMAL]);
+ style->background[GTK_STATE_NORMAL] = cairo_pattern_reference (pattern);
+ gtk_widget_set_style (widget, style);
+ g_object_unref (style);
+ }
break;
+ }
default:
- g_assert_not_reached ();
+ /* nothing */
break;
}
}
@@ -1572,38 +1550,19 @@ panel_applet_update_background_for_widget (GtkWidget *widget,
static void
panel_applet_handle_background (PanelApplet *applet)
{
- PanelAppletBackgroundType type;
- GdkColor color;
- GdkPixmap *pixmap;
+ cairo_pattern_t *pattern;
- type = panel_applet_get_background (applet, &color, &pixmap);
+ pattern = panel_applet_get_background (applet);
if (applet->priv->background_widget)
panel_applet_update_background_for_widget (applet->priv->background_widget,
- type, &color, pixmap);
+ pattern);
- switch (type) {
- case PANEL_NO_BACKGROUND:
- g_signal_emit (G_OBJECT (applet),
- panel_applet_signals [CHANGE_BACKGROUND],
- 0, PANEL_NO_BACKGROUND, NULL, NULL);
- break;
- case PANEL_COLOR_BACKGROUND:
- g_signal_emit (G_OBJECT (applet),
- panel_applet_signals [CHANGE_BACKGROUND],
- 0, PANEL_COLOR_BACKGROUND, &color, NULL);
- break;
- case PANEL_PIXMAP_BACKGROUND:
- g_signal_emit (G_OBJECT (applet),
- panel_applet_signals [CHANGE_BACKGROUND],
- 0, PANEL_PIXMAP_BACKGROUND, NULL, pixmap);
-
- g_object_unref (pixmap);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
+ g_signal_emit (G_OBJECT (applet),
+ panel_applet_signals [CHANGE_BACKGROUND],
+ 0, pattern);
+ if (pattern)
+ cairo_pattern_destroy (pattern);
}
static void
@@ -1747,10 +1706,10 @@ add_tab_bindings (GtkBindingSet *binding_set,
GdkModifierType modifiers,
GtkDirectionType direction)
{
- gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
"move_focus_out_of_applet", 1,
GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
"move_focus_out_of_applet", 1,
GTK_TYPE_DIRECTION_TYPE, direction);
}
@@ -1854,26 +1813,25 @@ static void
panel_applet_class_init (PanelAppletClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
GtkBindingSet *binding_set;
gobject_class->get_property = panel_applet_get_property;
gobject_class->set_property = panel_applet_set_property;
gobject_class->constructed = panel_applet_constructed;
+ gobject_class->finalize = panel_applet_finalize;
+
klass->move_focus_out_of_applet = panel_applet_move_focus_out_of_applet;
widget_class->button_press_event = panel_applet_button_press;
widget_class->button_release_event = panel_applet_button_release;
widget_class->size_request = panel_applet_size_request;
widget_class->size_allocate = panel_applet_size_allocate;
- widget_class->expose_event = panel_applet_expose;
+ widget_class->draw = panel_applet_draw;
widget_class->focus = panel_applet_focus;
widget_class->realize = panel_applet_realize;
widget_class->popup_menu = panel_applet_popup_menu;
- gobject_class->finalize = panel_applet_finalize;
-
g_type_class_add_private (klass, sizeof (PanelAppletPrivate));
g_object_class_install_property (gobject_class,
@@ -1906,6 +1864,7 @@ panel_applet_class_init (PanelAppletClass *klass)
"GConf Preferences Key",
NULL,
G_PARAM_READWRITE));
+ // FIXMEchpe GtkOrientation?
g_object_class_install_property (gobject_class,
PROP_ORIENT,
g_param_spec_uint ("orient",
@@ -1963,7 +1922,7 @@ panel_applet_class_init (PanelAppletClass *klass)
G_STRUCT_OFFSET (PanelAppletClass, change_orient),
NULL,
NULL,
- panel_applet_marshal_VOID__UINT,
+ g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE,
1,
G_TYPE_UINT);
@@ -1975,7 +1934,7 @@ panel_applet_class_init (PanelAppletClass *klass)
G_STRUCT_OFFSET (PanelAppletClass, change_size),
NULL,
NULL,
- panel_applet_marshal_VOID__INT,
+ g_cclosure_marshal_VOID__INT,
G_TYPE_NONE,
1,
G_TYPE_INT);
@@ -1987,12 +1946,10 @@ panel_applet_class_init (PanelAppletClass *klass)
G_STRUCT_OFFSET (PanelAppletClass, change_background),
NULL,
NULL,
- panel_applet_marshal_VOID__ENUM_BOXED_OBJECT,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
- 3,
- PANEL_TYPE_PANEL_APPLET_BACKGROUND_TYPE,
- GDK_TYPE_COLOR,
- GDK_TYPE_PIXMAP);
+ 1,
+ CAIRO_GOBJECT_TYPE_PATTERN);
panel_applet_signals [MOVE_FOCUS_OUT_OF_APPLET] =
g_signal_new ("move_focus_out_of_applet",
@@ -2001,12 +1958,12 @@ panel_applet_class_init (PanelAppletClass *klass)
G_STRUCT_OFFSET (PanelAppletClass, move_focus_out_of_applet),
NULL,
NULL,
- panel_applet_marshal_VOID__ENUM,
+ g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE,
1,
GTK_TYPE_DIRECTION_TYPE);
- binding_set = gtk_binding_set_by_class (object_class);
+ binding_set = gtk_binding_set_by_class (gobject_class);
add_tab_bindings (binding_set, 0, GTK_DIR_TAB_FORWARD);
add_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
@@ -2283,16 +2240,13 @@ panel_applet_set_background_widget (PanelApplet *applet,
{
applet->priv->background_widget = widget;
- if (widget) {
- PanelAppletBackgroundType type;
- GdkColor color;
- GdkPixmap *pixmap;
+ if (widget && gtk_widget_get_realized (widget)) {
+ cairo_pattern_t *pattern;
- type = panel_applet_get_background (applet, &color, &pixmap);
- panel_applet_update_background_for_widget (widget, type,
- &color, pixmap);
- if (type == PANEL_PIXMAP_BACKGROUND)
- g_object_unref (pixmap);
+ pattern = panel_applet_get_background (applet);
+ panel_applet_update_background_for_widget (widget, pattern);
+ if (pattern)
+ cairo_pattern_destroy (pattern);
}
}
diff --git a/libpanel-applet/panel-applet.h b/libpanel-applet/panel-applet.h
index dc79c60..479d8b2 100644
--- a/libpanel-applet/panel-applet.h
+++ b/libpanel-applet/panel-applet.h
@@ -45,12 +45,6 @@ typedef enum {
#define PANEL_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PANEL_TYPE_APPLET, PanelAppletClass))
typedef enum {
- PANEL_NO_BACKGROUND,
- PANEL_COLOR_BACKGROUND,
- PANEL_PIXMAP_BACKGROUND
-} PanelAppletBackgroundType;
-
-typedef enum {
PANEL_APPLET_FLAGS_NONE = 0,
PANEL_APPLET_EXPAND_MAJOR = 1 << 0,
PANEL_APPLET_EXPAND_MINOR = 1 << 1,
@@ -80,10 +74,8 @@ struct _PanelAppletClass {
void (*change_size) (PanelApplet *applet,
guint size);
- void (*change_background) (PanelApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap);
+ void (*change_background) (PanelApplet *applet,
+ cairo_pattern_t *pattern);
void (*move_focus_out_of_applet) (PanelApplet *frame,
GtkDirectionType direction);
};
@@ -94,11 +86,7 @@ GtkWidget *panel_applet_new (void);
PanelAppletOrient panel_applet_get_orient (PanelApplet *applet);
guint panel_applet_get_size (PanelApplet *applet);
-PanelAppletBackgroundType
- panel_applet_get_background (PanelApplet *applet,
- /* return values */
- GdkColor *color,
- GdkPixmap **pixmap);
+cairo_pattern_t *panel_applet_get_background (PanelApplet *applet);
void panel_applet_set_background_widget (PanelApplet *applet,
GtkWidget *widget);
diff --git a/libpanel-applet/test-dbus-applet.c b/libpanel-applet/test-dbus-applet.c
index 4f14b2a..8046b5d 100644
--- a/libpanel-applet/test-dbus-applet.c
+++ b/libpanel-applet/test-dbus-applet.c
@@ -111,31 +111,12 @@ test_applet_handle_size_change (TestApplet *applet,
static void
test_applet_handle_background_change (TestApplet *applet,
- PanelAppletBackgroundType type,
- GdkColor *color,
- GdkPixmap *pixmap,
+ cairo_pattern_t *pattern,
gpointer dummy)
{
GdkWindow *window = gtk_widget_get_window (applet->label);
- switch (type) {
- case PANEL_NO_BACKGROUND:
- g_message ("Setting background to default");
- gdk_window_set_back_pixmap (window, NULL, FALSE);
- break;
- case PANEL_COLOR_BACKGROUND:
- g_message ("Setting background to #%2x%2x%2x",
- color->red, color->green, color->blue);
- gdk_window_set_back_pixmap (window, NULL, FALSE);
- break;
- case PANEL_PIXMAP_BACKGROUND:
- g_message ("Setting background to '%p'", pixmap);
- gdk_window_set_back_pixmap (window, pixmap, FALSE);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
+ gdk_window_set_background_pattern (window, pattern);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]