[gnome-panel] [all] More GSeal work
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] [all] More GSeal work
- Date: Tue, 22 Jun 2010 22:55:09 +0000 (UTC)
commit ee22097fbcd9196932b74313aa9807987de8557d
Author: Vincent Untz <vuntz gnome org>
Date: Tue Jun 22 23:49:48 2010 +0200
[all] More GSeal work
applets/clock/calendar-window.c | 7 +-
applets/clock/clock-face.c | 40 ++++++----
applets/clock/clock-location-tile.c | 12 ++-
applets/clock/clock-map.c | 39 ++++++----
applets/clock/clock.c | 44 ++++++----
applets/fish/fish.c | 80 ++++++++++++++------
applets/notification_area/fixedtip.c | 17 +++--
applets/notification_area/na-tray-child.c | 59 +++++++++-----
applets/notification_area/na-tray-manager.c | 38 ++++++---
applets/notification_area/na-tray.c | 13 ++-
applets/notification_area/testtray.c | 2 +-
applets/wncklet/showdesktop.c | 7 +-
applets/wncklet/window-menu.c | 6 +-
libpanel-applet/panel-applet.c | 113 +++++++++++++++------------
libpanel-applet/test-dbus-applet.c | 8 +-
15 files changed, 302 insertions(+), 183 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index ad27c16..932ebda 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1323,7 +1323,7 @@ constrain_list_size (GtkWidget *widget,
gtk_widget_size_request (constraint->tree, &req);
requisition->height = MIN (req.height, max_height);
- requisition->height += 2 * widget->style->ythickness;
+ requisition->height += 2 * gtk_widget_get_style (widget)->ythickness;
}
static void
@@ -1951,15 +1951,12 @@ calendar_window_new (time_t *static_current_time,
CalendarWindow *calwin;
calwin = g_object_new (CALENDAR_TYPE_WINDOW,
+ "type", GTK_WINDOW_TOPLEVEL,
"current-time", static_current_time,
"invert-order", invert_order,
"prefs-dir", prefs_dir,
NULL);
- /* It doesn't work if we do this in calendar_window_init(), so do it
- * here */
- GTK_WINDOW (calwin)->type = GTK_WINDOW_TOPLEVEL;
-
return GTK_WIDGET (calwin);
}
diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c
index 3d27d13..07bb230 100644
--- a/applets/clock/clock-face.c
+++ b/applets/clock/clock-face.c
@@ -90,13 +90,14 @@ clock_face_init (ClockFace *this)
priv->location = NULL;
priv->size_widget = NULL;
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (this), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (this), FALSE);
}
static void
draw (GtkWidget *this, cairo_t *cr)
{
ClockFacePrivate *priv;
+ GtkAllocation allocation;
double x, y;
double radius;
int hours, minutes, seconds;
@@ -116,26 +117,27 @@ draw (GtkWidget *this, cairo_t *cr)
sec_length = 0.8; /* not drawn currently */
}
+ gtk_widget_get_allocation (this, &allocation);
- x = this->allocation.x + this->allocation.width / 2;
- y = this->allocation.y + this->allocation.height / 2;
- radius = MIN (this->allocation.width / 2,
- this->allocation.height / 2) - 5;
+ x = allocation.x + allocation.width / 2;
+ y = allocation.y + allocation.height / 2;
+ radius = MIN (allocation.width / 2,
+ allocation.height / 2) - 5;
cairo_save (cr);
- cairo_translate (cr, this->allocation.x, this->allocation.y);
+ cairo_translate (cr, allocation.x, allocation.y);
/* clock back */
if (priv->face_pixbuf) {
- GdkWindow *window = this->window;
+ GdkWindow *window = gtk_widget_get_window (this);
gdk_draw_pixbuf (GDK_DRAWABLE (window),
NULL,
priv->face_pixbuf,
0, 0,
- this->allocation.x,
- this->allocation.y,
- this->allocation.width,
- this->allocation.height,
+ allocation.x,
+ allocation.y,
+ allocation.width,
+ allocation.height,
GDK_RGB_DITHER_NONE, 0, 0);
}
@@ -188,7 +190,7 @@ clock_face_expose (GtkWidget *this, GdkEventExpose *event)
cairo_t *cr;
/* get a cairo_t */
- cr = gdk_cairo_create (this->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (this));
cairo_rectangle (cr,
event->area.x, event->area.y,
@@ -250,10 +252,13 @@ static void
clock_face_size_allocate (GtkWidget *this,
GtkAllocation *allocation)
{
+ GtkAllocation this_allocation;
GtkAllocation old_allocation;
- old_allocation.width = this->allocation.width;
- old_allocation.height = this->allocation.height;
+ gtk_widget_get_allocation (this, &this_allocation);
+
+ old_allocation.width = this_allocation.width;
+ old_allocation.height = this_allocation.height;
if (GTK_WIDGET_CLASS (clock_face_parent_class)->size_allocate)
GTK_WIDGET_CLASS (clock_face_parent_class)->size_allocate (this, allocation);
@@ -304,12 +309,15 @@ update_time_and_face (ClockFace *this,
timeofday = CLOCK_FACE_NIGHT;
if (priv->timeofday != timeofday || force_face_loading) {
+ GtkAllocation allocation;
gint width, height;
priv->timeofday = timeofday;
- width = GTK_WIDGET (this)->allocation.width;
- height = GTK_WIDGET (this)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
+
+ width = allocation.width;
+ height = allocation.height;
/* Only load the pixbuf if we have some space allocated.
* Note that 1x1 is not really some space... */
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c
index 67b72f3..7fe9b4d 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -197,11 +197,15 @@ make_current (GtkWidget *widget, ClockLocationTile *tile)
GtkWidget *toplevel;
guint xid;
+ xid = 0;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tile));
- if (toplevel && toplevel->window)
- xid = GDK_WINDOW_XWINDOW (toplevel->window);
- else
- xid = 0;
+
+ if (toplevel) {
+ GdkWindow *window = gtk_widget_get_window (toplevel);
+
+ if (window)
+ xid = GDK_WINDOW_XWINDOW (window);
+ }
clock_location_make_current (priv->location,
xid,
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 9b547c3..5a6e037 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -120,7 +120,7 @@ clock_map_init (ClockMap *this)
int i;
ClockMapPrivate *priv = PRIVATE (this);
- GTK_WIDGET_SET_FLAGS (this, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (this), FALSE);
priv->last_refresh = 0;
priv->width = 0;
@@ -182,22 +182,25 @@ clock_map_refresh (ClockMap *this)
{
ClockMapPrivate *priv = PRIVATE (this);
GtkWidget *widget = GTK_WIDGET (this);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
/* Only do something if we have some space allocated.
* Note that 1x1 is not really some space... */
- if (widget->allocation.width <= 1 || widget->allocation.height <= 1)
+ if (allocation.width <= 1 || allocation.height <= 1)
return;
/* Allocation changed => we reload the map */
- if (priv->width != widget->allocation.width ||
- priv->height != widget->allocation.height) {
+ if (priv->width != allocation.width ||
+ priv->height != allocation.height) {
if (priv->stock_map_pixbuf) {
g_object_unref (priv->stock_map_pixbuf);
priv->stock_map_pixbuf = NULL;
}
- priv->width = widget->allocation.width;
- priv->height = widget->allocation.height;
+ priv->width = allocation.width;
+ priv->height = allocation.height;
}
if (!priv->stock_map_pixbuf) {
@@ -217,16 +220,22 @@ static gboolean
clock_map_expose (GtkWidget *this, GdkEventExpose *event)
{
ClockMapPrivate *priv = PRIVATE (this);
- GtkAllocation allocation = this->allocation;
+ GdkWindow *window;
+ GtkStyle *style;
+ GtkAllocation allocation;
GdkRectangle region;
cairo_t *cr;
+ window = gtk_widget_get_window (this);
+ style = gtk_widget_get_style (this);
+ gtk_widget_get_allocation (this, &allocation);
+
if (!priv->shadow_map_pixbuf) {
g_warning ("Needed to refresh the map in expose event.");
clock_map_refresh (CLOCK_MAP (this));
}
- cr = gdk_cairo_create (this->window);
+ cr = gdk_cairo_create (window);
region.x = allocation.x;
region.y = allocation.y;
@@ -234,8 +243,8 @@ clock_map_expose (GtkWidget *this, GdkEventExpose *event)
region.height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf);
gdk_rectangle_intersect (®ion, &(event->area), ®ion);
- gdk_draw_pixbuf (this->window,
- this->style->black_gc,
+ gdk_draw_pixbuf (window,
+ style->black_gc,
priv->shadow_map_pixbuf,
region.x - allocation.x,
region.y - allocation.y,
@@ -255,9 +264,9 @@ clock_map_expose (GtkWidget *this, GdkEventExpose *event)
cairo_set_source_rgb (
cr,
- this->style->mid [GTK_STATE_ACTIVE].red / 65535.0,
- this->style->mid [GTK_STATE_ACTIVE].green / 65535.0,
- this->style->mid [GTK_STATE_ACTIVE].blue / 65535.0);
+ 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_set_line_width (cr, 1.0);
cairo_stroke (cr);
@@ -282,8 +291,8 @@ clock_map_size_allocate (GtkWidget *this, GtkAllocation *allocation)
if (GTK_WIDGET_CLASS (clock_map_parent_class)->size_allocate)
GTK_WIDGET_CLASS (clock_map_parent_class)->size_allocate (this, allocation);
- if (priv->width != this->allocation.width ||
- priv->height != this->allocation.height)
+ if (priv->width != allocation->width ||
+ priv->height != allocation->height)
clock_map_refresh (CLOCK_MAP (this));
}
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 9786234..c4f4a02 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -290,7 +290,7 @@ calculate_minimum_width (GtkWidget *widget,
"focus-padding", &focus_pad,
NULL);
- width += 2 * (focus_width + focus_pad + widget->style->xthickness);
+ width += 2 * (focus_width + focus_pad + gtk_widget_get_style (widget)->xthickness);
return width;
}
@@ -382,6 +382,7 @@ static int
calculate_minimum_height (GtkWidget *widget,
PanelAppletOrient orientation)
{
+ GtkStyle *style;
PangoContext *context;
PangoFontMetrics *metrics;
int focus_width = 0;
@@ -390,9 +391,10 @@ calculate_minimum_height (GtkWidget *widget,
int descent;
int thickness;
+ style = gtk_widget_get_style (widget);
context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
- widget->style->font_desc,
+ style->font_desc,
pango_context_get_language (context));
ascent = pango_font_metrics_get_ascent (metrics);
@@ -407,9 +409,9 @@ calculate_minimum_height (GtkWidget *widget,
if (orientation == PANEL_APPLET_ORIENT_UP
|| orientation == PANEL_APPLET_ORIENT_DOWN) {
- thickness = widget->style->ythickness;
+ thickness = style->ythickness;
} else {
- thickness = widget->style->xthickness;
+ thickness = style->xthickness;
}
return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad + thickness);
@@ -864,6 +866,7 @@ static void
position_calendar_popup (ClockData *cd)
{
GtkRequisition req;
+ GtkAllocation allocation;
GdkScreen *screen;
GdkRectangle monitor;
GdkGravity gravity = GDK_GRAVITY_NORTH_WEST;
@@ -874,15 +877,17 @@ position_calendar_popup (ClockData *cd)
gboolean found_monitor = FALSE;
/* Get root origin of the toggle button, and position above that. */
- gdk_window_get_origin (cd->panel_button->window, &x, &y);
+ gdk_window_get_origin (gtk_widget_get_window (cd->panel_button),
+ &x, &y);
gtk_window_get_size (GTK_WINDOW (cd->calendar_popup), &w, &h);
gtk_widget_size_request (cd->calendar_popup, &req);
w = req.width;
h = req.height;
- button_w = cd->panel_button->allocation.width;
- button_h = cd->panel_button->allocation.height;
+ gtk_widget_get_allocation (cd->panel_button, &allocation);
+ button_w = allocation.width;
+ button_h = allocation.height;
screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup));
@@ -1436,19 +1441,21 @@ create_clock_widget (ClockData *cd)
static void
update_orient (ClockData *cd)
{
- const gchar *text;
- int min_width;
- gdouble new_angle;
- gdouble angle;
+ const gchar *text;
+ int min_width;
+ GtkAllocation allocation;
+ gdouble new_angle;
+ gdouble angle;
text = gtk_label_get_text (GTK_LABEL (cd->clockw));
min_width = calculate_minimum_width (cd->panel_button, text);
+ gtk_widget_get_allocation (cd->panel_button, &allocation);
if (cd->orient == PANEL_APPLET_ORIENT_LEFT &&
- min_width > cd->panel_button->allocation.width)
+ min_width > allocation.width)
new_angle = 270;
else if (cd->orient == PANEL_APPLET_ORIENT_RIGHT &&
- min_width > cd->panel_button->allocation.width)
+ min_width > allocation.width)
new_angle = 90;
else
new_angle = 0;
@@ -2181,7 +2188,8 @@ location_start_element (GMarkupParseContext *context,
latitude, longitude, code, &prefs);
if (current && clock_location_is_current_timezone (loc))
- clock_location_make_current (loc, GDK_WINDOW_XWINDOW (cd->applet->window), NULL, NULL, NULL);
+ clock_location_make_current (loc, GDK_WINDOW_XWINDOW (gtk_widget_get_window (cd->applet)),
+ NULL, NULL, NULL);
data->cities = g_list_append (data->cities, loc);
}
@@ -2776,7 +2784,7 @@ set_show_seconds_cb (GtkWidget *w,
{
panel_applet_gconf_set_bool (PANEL_APPLET (clock->applet),
KEY_SHOW_SECONDS,
- GTK_TOGGLE_BUTTON (w)->active,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)),
NULL);
}
@@ -2786,7 +2794,7 @@ set_show_date_cb (GtkWidget *w,
{
panel_applet_gconf_set_bool (PANEL_APPLET (clock->applet),
KEY_SHOW_DATE,
- GTK_TOGGLE_BUTTON (w)->active,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)),
NULL);
}
@@ -2796,7 +2804,7 @@ set_show_weather_cb (GtkWidget *w,
{
panel_applet_gconf_set_bool (PANEL_APPLET (clock->applet),
KEY_SHOW_WEATHER,
- GTK_TOGGLE_BUTTON (w)->active,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)),
NULL);
}
@@ -2806,7 +2814,7 @@ set_show_temperature_cb (GtkWidget *w,
{
panel_applet_gconf_set_bool (PANEL_APPLET (clock->applet),
KEY_SHOW_TEMPERATURE,
- GTK_TOGGLE_BUTTON (w)->active,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)),
NULL);
}
diff --git a/applets/fish/fish.c b/applets/fish/fish.c
index b732043..65ec3be 100644
--- a/applets/fish/fish.c
+++ b/applets/fish/fish.c
@@ -72,6 +72,7 @@ typedef struct {
GtkWidget *frame;
GtkWidget *drawing_area;
+ GtkRequisition requisition;
GdkRectangle prev_allocation;
GdkPixmap *pixmap;
guint timeout;
@@ -893,6 +894,7 @@ display_fortune_dialog (FishApplet *fish)
if (!fish->fortune_dialog) {
GtkWidget *scrolled;
+ GtkWidget *vbox;
GdkScreen *screen;
int screen_width;
int screen_height;
@@ -956,15 +958,16 @@ display_fortune_dialog (FishApplet *fish)
gtk_misc_set_alignment (GTK_MISC (fish->fortune_cmd_label),
0, 0.5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (fish->fortune_dialog)->vbox),
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (fish->fortune_dialog));
+ gtk_box_pack_start (GTK_BOX (vbox),
fish->fortune_label,
FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (fish->fortune_dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (vbox),
scrolled,
TRUE, TRUE, 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (fish->fortune_dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (vbox),
fish->fortune_cmd_label,
FALSE, FALSE, 6);
@@ -1455,19 +1458,22 @@ load_fish_image (FishApplet *fish)
static void
update_pixmap (FishApplet *fish)
{
- GtkWidget *widget = fish->drawing_area;
- int width = -1;
- int height = -1;
- int pixbuf_width = -1;
- int pixbuf_height = -1;
- gboolean rotate = FALSE;
- cairo_t *cr;
+ GtkWidget *widget = fish->drawing_area;
+ GtkAllocation allocation;
+ int width = -1;
+ int height = -1;
+ int pixbuf_width = -1;
+ int pixbuf_height = -1;
+ gboolean rotate = FALSE;
+ cairo_t *cr;
cairo_matrix_t matrix;
cairo_pattern_t *pattern;
+ gtk_widget_get_allocation (widget, &allocation);
+
if (!gtk_widget_get_realized (widget) ||
- widget->allocation.width <= 0 ||
- widget->allocation.height <= 0)
+ allocation.width <= 0 ||
+ allocation.height <= 0)
return;
if (!fish->pixbuf && !load_fish_image (fish))
@@ -1483,18 +1489,21 @@ update_pixmap (FishApplet *fish)
if (fish->orientation == PANEL_APPLET_ORIENT_UP ||
fish->orientation == PANEL_APPLET_ORIENT_DOWN) {
- height = widget->allocation.height;
+ height = allocation.height;
width = pixbuf_width * ((gdouble) height / pixbuf_height);
- widget->requisition.width = width / fish->n_frames;
+ fish->requisition.width = width / fish->n_frames;
+ fish->requisition.height = height;
} else {
if (!rotate) {
- width = widget->allocation.width * fish->n_frames;
+ width = allocation.width * fish->n_frames;
height = pixbuf_height * ((gdouble) width / pixbuf_width);
- widget->requisition.height = height;
+ fish->requisition.width = width;
+ fish->requisition.height = height;
} else {
- width = widget->allocation.width;
+ width = allocation.width;
height = pixbuf_width * ((gdouble) width / pixbuf_height);
- widget->requisition.height = height / fish->n_frames;
+ fish->requisition.width = width;
+ fish->requisition.height = height / fish->n_frames;
}
}
@@ -1505,7 +1514,8 @@ update_pixmap (FishApplet *fish)
if (fish->pixmap)
g_object_unref (fish->pixmap);
- fish->pixmap = gdk_pixmap_new (widget->window, width, height, -1);
+ fish->pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
+ width, height, -1);
gtk_widget_queue_resize (widget);
@@ -1563,6 +1573,9 @@ fish_applet_expose_event (GtkWidget *widget,
GdkEventExpose *event,
FishApplet *fish)
{
+ GdkWindow *window;
+ GtkStyle *style;
+ GtkStateType state;
int width, height;
int src_x, src_y;
@@ -1570,6 +1583,10 @@ fish_applet_expose_event (GtkWidget *widget,
g_assert (fish->n_frames > 0);
+ window = gtk_widget_get_window (widget);
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
+
gdk_drawable_get_size (fish->pixmap, &width, &height);
src_x = event->area.x;
@@ -1585,8 +1602,8 @@ fish_applet_expose_event (GtkWidget *widget,
} else
src_x += ((width * fish->current_frame) / fish->n_frames);
- gdk_draw_drawable (widget->window,
- widget->style->fg_gc [GTK_WIDGET_STATE (widget)],
+ gdk_draw_drawable (window,
+ style->fg_gc [state],
fish->pixmap,
src_x, src_y,
event->area.x, event->area.y,
@@ -1596,12 +1613,24 @@ fish_applet_expose_event (GtkWidget *widget,
}
static void
+fish_applet_size_request (GtkWidget *widget,
+ GtkRequisition *requisition,
+ FishApplet *fish)
+{
+ *requisition = fish->requisition;
+}
+
+static void
fish_applet_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
FishApplet *fish)
{
- if (widget->allocation.width != fish->prev_allocation.width ||
- widget->allocation.height != fish->prev_allocation.height)
+ GtkAllocation widget_allocation;
+
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ if (widget_allocation.width != fish->prev_allocation.width ||
+ widget_allocation.height != fish->prev_allocation.height)
update_pixmap (fish);
fish->prev_allocation = *allocation;
@@ -1766,6 +1795,8 @@ setup_fish_widget (FishApplet *fish)
G_CALLBACK (fish_applet_realize), fish);
g_signal_connect (fish->drawing_area, "unrealize",
G_CALLBACK (fish_applet_unrealize), fish);
+ g_signal_connect (fish->drawing_area, "size-request",
+ G_CALLBACK (fish_applet_size_request), fish);
g_signal_connect (fish->drawing_area, "size-allocate",
G_CALLBACK (fish_applet_size_allocate), fish);
g_signal_connect (fish->drawing_area, "expose-event",
@@ -2024,6 +2055,9 @@ fish_applet_instance_init (FishApplet *fish,
fish->current_frame = 0;
fish->in_applet = FALSE;
+ fish->requisition.width = -1;
+ fish->requisition.height = -1;
+
fish->prev_allocation.x = -1;
fish->prev_allocation.y = -1;
fish->prev_allocation.width = -1;
diff --git a/applets/notification_area/fixedtip.c b/applets/notification_area/fixedtip.c
index 53ac923..b9b2c08 100644
--- a/applets/notification_area/fixedtip.c
+++ b/applets/notification_area/fixedtip.c
@@ -58,7 +58,8 @@ expose_handler (GtkWidget *fixedtip)
gtk_widget_size_request (fixedtip, &req);
- gtk_paint_flat_box (fixedtip->style, fixedtip->window,
+ gtk_paint_flat_box (gtk_widget_get_style (fixedtip),
+ gtk_widget_get_window (fixedtip),
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, fixedtip, "tooltip",
0, 0, req.width, req.height);
@@ -120,6 +121,7 @@ static void
na_fixed_tip_position (NaFixedTip *fixedtip)
{
GdkScreen *screen;
+ GdkWindow *parent_window;
GtkRequisition req;
int root_x;
int root_y;
@@ -129,12 +131,14 @@ na_fixed_tip_position (NaFixedTip *fixedtip)
int screen_height;
screen = gtk_widget_get_screen (fixedtip->priv->parent);
+ parent_window = gtk_widget_get_window (fixedtip->priv->parent);
+
gtk_window_set_screen (GTK_WINDOW (fixedtip), screen);
gtk_widget_size_request (GTK_WIDGET (fixedtip), &req);
- gdk_window_get_origin (fixedtip->priv->parent->window, &root_x, &root_y);
- gdk_drawable_get_size (GDK_DRAWABLE (fixedtip->priv->parent->window),
+ gdk_window_get_origin (parent_window, &root_x, &root_y);
+ gdk_drawable_get_size (GDK_DRAWABLE (parent_window),
&parent_width, &parent_height);
screen_width = gdk_screen_get_width (screen);
@@ -192,10 +196,9 @@ na_fixed_tip_new (GtkWidget *parent,
g_return_val_if_fail (parent != NULL, NULL);
- fixedtip = g_object_new (NA_TYPE_FIXED_TIP, NULL);
-
- /* It doesn't work if we do this in na_fixed_tip_init(), so do it here */
- GTK_WINDOW (fixedtip)->type = GTK_WINDOW_POPUP;
+ fixedtip = g_object_new (NA_TYPE_FIXED_TIP,
+ "type", GTK_WINDOW_POPUP,
+ NULL);
fixedtip->priv->parent = parent;
diff --git a/applets/notification_area/na-tray-child.c b/applets/notification_area/na-tray-child.c
index 576efbd..ccc2368 100644
--- a/applets/notification_area/na-tray-child.c
+++ b/applets/notification_area/na-tray-child.c
@@ -42,9 +42,12 @@ na_tray_child_realize (GtkWidget *widget)
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
GdkVisual *visual = gtk_widget_get_visual (widget);
+ GdkWindow *window;
GTK_WIDGET_CLASS (na_tray_child_parent_class)->realize (widget);
+ window = gtk_widget_get_window (widget);
+
if (child->has_alpha)
{
/* We have real transparency with an ARGB visual and the Composite
@@ -52,16 +55,16 @@ na_tray_child_realize (GtkWidget *widget)
/* Set a transparent background */
GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */
- gdk_window_set_background (widget->window, &transparent);
- gdk_window_set_composited (widget->window, TRUE);
+ gdk_window_set_background (window, &transparent);
+ gdk_window_set_composited (window, TRUE);
child->parent_relative_bg = FALSE;
}
- else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (widget->window))))
+ else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (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 (widget->window, NULL, TRUE);
+ gdk_window_set_back_pixmap (window, NULL, TRUE);
child->parent_relative_bg = TRUE;
}
@@ -71,7 +74,7 @@ na_tray_child_realize (GtkWidget *widget)
child->parent_relative_bg = FALSE;
}
- gdk_window_set_composited (widget->window, child->composited);
+ gdk_window_set_composited (window, child->composited);
gtk_widget_set_app_paintable (GTK_WIDGET (child),
child->parent_relative_bg || child->has_alpha);
@@ -128,11 +131,14 @@ na_tray_child_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
+ GtkAllocation widget_allocation;
+
+ gtk_widget_get_allocation (widget, &widget_allocation);
- gboolean moved = allocation->x != widget->allocation.x ||
- allocation->y != widget->allocation.y;
- gboolean resized = allocation->width != widget->allocation.width ||
- allocation->height != widget->allocation.height;
+ gboolean moved = allocation->x != widget_allocation.x ||
+ allocation->y != widget_allocation.y;
+ gboolean resized = allocation->width != widget_allocation.width ||
+ allocation->height != widget_allocation.height;
/* When we are allocating the widget while mapped we need special handling
* for both real and fake transparency.
@@ -147,8 +153,8 @@ na_tray_child_size_allocate (GtkWidget *widget,
if ((moved || resized) && gtk_widget_get_mapped (widget))
{
if (na_tray_child_has_alpha (child))
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+ &widget_allocation, FALSE);
}
GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_allocate (widget,
@@ -157,8 +163,8 @@ na_tray_child_size_allocate (GtkWidget *widget,
if ((moved || resized) && gtk_widget_get_mapped (widget))
{
if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+ &widget_allocation, FALSE);
else if (moved && child->parent_relative_bg)
na_tray_child_force_redraw (child);
}
@@ -173,11 +179,12 @@ na_tray_child_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
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 (widget->window);
+ 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);
@@ -187,7 +194,7 @@ na_tray_child_expose_event (GtkWidget *widget,
else if (child->parent_relative_bg)
{
/* Clear to parent-relative pixmap */
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (window,
event->area.x, event->area.y,
event->area.width, event->area.height);
}
@@ -227,6 +234,7 @@ na_tray_child_new (GdkScreen *screen,
gboolean visual_has_alpha;
GdkColormap *colormap;
gboolean new_colormap;
+ int red_prec, green_prec, blue_prec, depth;
int result;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
@@ -272,7 +280,12 @@ na_tray_child_new (GdkScreen *screen,
/* We have alpha if the visual has something other than red, green,
* and blue */
- visual_has_alpha = visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth;
+ gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
+ gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
+ gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+ depth = gdk_visual_get_depth (visual);
+
+ visual_has_alpha = red_prec + blue_prec + green_prec < depth;
child->has_alpha = (visual_has_alpha &&
gdk_display_supports_composite (gdk_screen_get_display (screen)));
@@ -379,7 +392,8 @@ na_tray_child_set_composited (NaTrayChild *child,
child->composited = composited;
if (gtk_widget_get_realized (GTK_WIDGET (child)))
- gdk_window_set_composited (GTK_WIDGET (child)->window, composited);
+ gdk_window_set_composited (gtk_widget_get_window (GTK_WIDGET (child)),
+ composited);
}
/* If we are faking transparency with a window-relative background, force a
@@ -400,13 +414,18 @@ na_tray_child_force_redraw (NaTrayChild *child)
*/
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
XEvent xev;
+ GdkWindow *plug_window;
+ GtkAllocation allocation;
+
+ plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
+ gtk_widget_get_allocation (widget, &allocation);
xev.xexpose.type = Expose;
- xev.xexpose.window = GDK_WINDOW_XWINDOW (GTK_SOCKET (child)->plug_window);
+ xev.xexpose.window = GDK_WINDOW_XWINDOW (plug_window);
xev.xexpose.x = 0;
xev.xexpose.y = 0;
- xev.xexpose.width = widget->allocation.width;
- xev.xexpose.height = widget->allocation.height;
+ xev.xexpose.width = allocation.width;
+ xev.xexpose.height = allocation.height;
xev.xexpose.count = 0;
gdk_error_trap_push ();
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index d2e1a75..4173cbd 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -296,7 +296,7 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
gtk_socket_add_id (GTK_SOCKET (child), icon_window);
- if (!GTK_SOCKET (child)->plug_window)
+ if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
{
/* Embedding failed, we won't get a plug-removed signal */
g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
@@ -539,21 +539,24 @@ na_tray_manager_unmanage (NaTrayManager *manager)
GdkDisplay *display;
guint32 timestamp;
GtkWidget *invisible;
+ GdkWindow *window;
if (manager->invisible == NULL)
return;
invisible = manager->invisible;
+ window = gtk_widget_get_window (invisible);
+
g_assert (GTK_IS_INVISIBLE (invisible));
g_assert (gtk_widget_get_realized (invisible));
- g_assert (GDK_IS_WINDOW (invisible->window));
+ g_assert (GDK_IS_WINDOW (window));
display = gtk_widget_get_display (invisible);
if (gdk_selection_owner_get_for_display (display, manager->selection_atom) ==
- invisible->window)
+ window)
{
- timestamp = gdk_x11_get_server_time (invisible->window);
+ timestamp = gdk_x11_get_server_time (window);
gdk_selection_owner_set_for_display (display,
NULL,
manager->selection_atom,
@@ -564,7 +567,7 @@ na_tray_manager_unmanage (NaTrayManager *manager)
//FIXME: we should also use gdk_remove_client_message_filter when it's
//available
// See bug #351254
- gdk_window_remove_filter (invisible->window,
+ gdk_window_remove_filter (window,
na_tray_manager_window_filter, manager);
manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
@@ -577,11 +580,14 @@ static void
na_tray_manager_set_orientation_property (NaTrayManager *manager)
{
#ifdef GDK_WINDOWING_X11
+ GdkWindow *window;
GdkDisplay *display;
Atom orientation_atom;
gulong data[1];
- if (!manager->invisible || !manager->invisible->window)
+ window = gtk_widget_get_window (manager->invisible);
+
+ if (!manager->invisible || !window)
return;
display = gtk_widget_get_display (manager->invisible);
@@ -593,7 +599,7 @@ na_tray_manager_set_orientation_property (NaTrayManager *manager)
SYSTEM_TRAY_ORIENTATION_VERT;
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XWINDOW (window),
orientation_atom,
XA_CARDINAL, 32,
PropModeReplace,
@@ -605,12 +611,15 @@ static void
na_tray_manager_set_visual_property (NaTrayManager *manager)
{
#ifdef GDK_WINDOWING_X11
+ GdkWindow *window;
GdkDisplay *display;
Visual *xvisual;
Atom visual_atom;
gulong data[1];
- if (!manager->invisible || !manager->invisible->window)
+ window = gtk_widget_get_window (manager->invisible);
+
+ if (!manager->invisible || !window)
return;
/* The visual property is a hint to the tray icons as to what visual they
@@ -645,7 +654,7 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
data[0] = XVisualIDFromVisual (xvisual);
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XWINDOW (window),
visual_atom,
XA_VISUALID, 32,
PropModeReplace,
@@ -662,6 +671,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
GdkDisplay *display;
Screen *xscreen;
GtkWidget *invisible;
+ GdkWindow *window;
char *selection_atom_name;
guint32 timestamp;
@@ -698,11 +708,13 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
na_tray_manager_set_orientation_property (manager);
na_tray_manager_set_visual_property (manager);
- timestamp = gdk_x11_get_server_time (invisible->window);
+ window = gtk_widget_get_window (invisible);
+
+ timestamp = gdk_x11_get_server_time (window);
/* Check if we could set the selection owner successfully */
if (gdk_selection_owner_set_for_display (display,
- invisible->window,
+ window,
manager->selection_atom,
timestamp,
TRUE))
@@ -720,7 +732,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
xev.data.l[0] = timestamp;
xev.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
manager->selection_atom);
- xev.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
+ xev.data.l[2] = GDK_WINDOW_XWINDOW (window);
xev.data.l[3] = 0; /* manager specific data */
xev.data.l[4] = 0; /* manager specific data */
@@ -743,7 +755,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
manager);
#endif
/* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
- gdk_window_add_filter (invisible->window,
+ gdk_window_add_filter (window,
na_tray_manager_window_filter, manager);
/* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
gdk_display_add_client_message_filter (display, opcode_atom,
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index ebd4ce4..45cba59 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -535,9 +535,14 @@ na_tray_expose_icon (GtkWidget *widget,
if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
{
- gdk_cairo_set_source_pixmap (cr, widget->window,
- widget->allocation.x,
- widget->allocation.y);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gdk_cairo_set_source_pixmap (cr,
+ gtk_widget_get_window (widget),
+ allocation.x,
+ allocation.y);
cairo_paint (cr);
}
}
@@ -546,7 +551,7 @@ static void
na_tray_expose_box (GtkWidget *box,
GdkEventExpose *event)
{
- cairo_t *cr = gdk_cairo_create (box->window);
+ cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (box));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c
index 3e34fec..4a4f56b 100644
--- a/applets/notification_area/testtray.c
+++ b/applets/notification_area/testtray.c
@@ -177,7 +177,7 @@ create_tray_on_screen (GdkScreen *screen,
data->tray = na_tray_new_for_screen (screen, GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (data->tray), TRUE, TRUE, 0);
- data->box = GTK_BIN (GTK_BIN (data->tray)->child)->child;
+ data->box = gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (data->tray))));
g_signal_connect_after (data->box, "add", G_CALLBACK (tray_added_cb), data);
g_signal_connect_after (data->box, "remove", G_CALLBACK (tray_removed_cb), data);
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index ff7cc67..bec0fb7 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -135,6 +135,7 @@ button_size_allocated (GtkWidget *button,
static void
update_icon (ShowDesktopData *sdd)
{
+ GtkStyle *style;
int width, height;
GdkPixbuf *icon;
GdkPixbuf *scaled;
@@ -152,12 +153,14 @@ update_icon (ShowDesktopData *sdd)
"focus-padding", &focus_pad,
NULL);
+ style = gtk_widget_get_style (sdd->button);
+
switch (sdd->orient) {
case GTK_ORIENTATION_HORIZONTAL:
- thickness = sdd->button->style->ythickness;
+ thickness = style->ythickness;
break;
case GTK_ORIENTATION_VERTICAL:
- thickness = sdd->button->style->xthickness;
+ thickness = style->xthickness;
break;
}
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index 0aa39d6..472cfb9 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -120,9 +120,9 @@ window_menu_on_expose (GtkWidget *widget,
WindowMenu *window_menu = data;
if (gtk_widget_has_focus (window_menu->applet))
- gtk_paint_focus (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
+ gtk_paint_focus (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
+ gtk_widget_get_state (widget),
NULL,
widget,
"menu-applet",
diff --git a/libpanel-applet/panel-applet.c b/libpanel-applet/panel-applet.c
index 58015d6..5b63561 100644
--- a/libpanel-applet/panel-applet.c
+++ b/libpanel-applet/panel-applet.c
@@ -633,7 +633,7 @@ panel_applet_find_toplevel_dock_window (PanelApplet *applet,
if (!gtk_widget_get_realized (toplevel))
return None;
- xwin = GDK_WINDOW_XID (toplevel->window);
+ xwin = GDK_WINDOW_XID (gtk_widget_get_window (toplevel));
child = NULL;
parent = root = None;
@@ -943,6 +943,7 @@ panel_applet_position_menu (GtkMenu *menu,
GtkWidget *widget)
{
PanelApplet *applet;
+ GtkAllocation allocation;
GtkRequisition requisition;
GdkScreen *screen;
int menu_x = 0;
@@ -957,26 +958,28 @@ panel_applet_position_menu (GtkMenu *menu,
screen = gtk_widget_get_screen (widget);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-
- gdk_window_get_origin (widget->window, &menu_x, &menu_y);
+ gdk_window_get_origin (gtk_widget_get_window (widget),
+ &menu_x, &menu_y);
gtk_widget_get_pointer (widget, &pointer_x, &pointer_y);
- menu_x += widget->allocation.x;
- menu_y += widget->allocation.y;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ menu_x += allocation.x;
+ menu_y += allocation.y;
if (applet->priv->orient == PANEL_APPLET_ORIENT_UP ||
applet->priv->orient == PANEL_APPLET_ORIENT_DOWN) {
if (gtk_widget_get_direction (GTK_WIDGET (menu)) != GTK_TEXT_DIR_RTL) {
- if (pointer_x < widget->allocation.width &&
+ if (pointer_x < allocation.width &&
requisition.width < pointer_x)
menu_x += MIN (pointer_x,
- widget->allocation.width - requisition.width);
+ allocation.width - requisition.width);
} else {
- menu_x += widget->allocation.width - requisition.width;
- if (pointer_x > 0 && pointer_x < widget->allocation.width &&
- pointer_x < widget->allocation.width - requisition.width) {
- menu_x -= MIN (widget->allocation.width - pointer_x,
- widget->allocation.width - requisition.width);
+ menu_x += allocation.width - requisition.width;
+ if (pointer_x > 0 && pointer_x < allocation.width &&
+ pointer_x < allocation.width - requisition.width) {
+ menu_x -= MIN (allocation.width - pointer_x,
+ allocation.width - requisition.width);
}
}
menu_x = MIN (menu_x, gdk_screen_get_width (screen) - requisition.width);
@@ -984,17 +987,17 @@ panel_applet_position_menu (GtkMenu *menu,
if (menu_y > gdk_screen_get_height (screen) / 2)
menu_y -= requisition.height;
else
- menu_y += widget->allocation.height;
+ menu_y += allocation.height;
} else {
- if (pointer_y < widget->allocation.height &&
+ if (pointer_y < allocation.height &&
requisition.height < pointer_y)
- menu_y += MIN (pointer_y, widget->allocation.height - requisition.height);
+ menu_y += MIN (pointer_y, allocation.height - requisition.height);
menu_y = MIN (menu_y, gdk_screen_get_height (screen) - requisition.height);
if (menu_x > gdk_screen_get_width (screen) / 2)
menu_x -= requisition.width;
else
- menu_x += widget->allocation.width;
+ menu_x += allocation.width;
}
@@ -1040,11 +1043,16 @@ static gboolean
panel_applet_button_event (GtkWidget *widget,
GdkEventButton *event)
{
- XEvent xevent;
+ GdkWindow *window;
+ GdkWindow *socket_window;
+ XEvent xevent;
- if (!GTK_WIDGET_TOPLEVEL (widget))
+ if (!gtk_widget_is_toplevel (widget))
return FALSE;
+ window = gtk_widget_get_window (widget);
+ socket_window = gtk_plug_get_socket_window (GTK_PLUG (widget));
+
if (event->type == GDK_BUTTON_PRESS) {
xevent.xbutton.type = ButtonPress;
@@ -1060,10 +1068,10 @@ panel_applet_button_event (GtkWidget *widget,
xevent.xbutton.type = ButtonRelease;
}
- xevent.xbutton.display = GDK_WINDOW_XDISPLAY (widget->window);
- xevent.xbutton.window = GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window);
+ 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 (widget->window)));
+ (gdk_drawable_get_screen (window)));
/*
* FIXME: the following might cause
* big problems for non-GTK apps
@@ -1078,8 +1086,8 @@ panel_applet_button_event (GtkWidget *widget,
gdk_error_trap_push ();
- XSendEvent (GDK_WINDOW_XDISPLAY (widget->window),
- GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window),
+ XSendEvent (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (socket_window),
False, NoEventMask, &xevent);
gdk_flush ();
@@ -1096,7 +1104,7 @@ panel_applet_button_press (GtkWidget *widget,
if (!container_has_focusable_child (GTK_CONTAINER (applet))) {
if (!gtk_widget_has_focus (widget)) {
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_grab_focus (widget);
}
}
@@ -1156,6 +1164,7 @@ panel_applet_size_allocate (GtkWidget *widget,
{
GtkAllocation child_allocation;
GtkBin *bin;
+ GtkWidget *child;
int border_width;
int focus_width = 0;
PanelApplet *applet;
@@ -1171,9 +1180,9 @@ panel_applet_size_allocate (GtkWidget *widget,
"focus-line-width", &focus_width,
NULL);
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
bin = GTK_BIN (widget);
child_allocation.x = focus_width;
@@ -1183,17 +1192,18 @@ panel_applet_size_allocate (GtkWidget *widget,
child_allocation.height = MAX (allocation->height - border_width * 2, 0);
if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (widget)->border_width,
- allocation->y + GTK_CONTAINER (widget)->border_width,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
+ allocation->x + border_width,
+ allocation->y + border_width,
child_allocation.width,
child_allocation.height);
child_allocation.width = MAX (child_allocation.width - 2 * focus_width, 0);
child_allocation.height = MAX (child_allocation.height - 2 * focus_width, 0);
- if (bin->child)
- gtk_widget_size_allocate (bin->child, &child_allocation);
+ child = gtk_bin_get_child (bin);
+ if (child)
+ gtk_widget_size_allocate (child, &child_allocation);
}
applet = PANEL_APPLET (widget);
@@ -1211,6 +1221,7 @@ static gboolean
panel_applet_expose (GtkWidget *widget,
GdkEventExpose *event)
{
+ GtkAllocation allocation;
int border_width;
int focus_width = 0;
int x, y, width, height;
@@ -1224,6 +1235,8 @@ panel_applet_expose (GtkWidget *widget,
if (!gtk_widget_has_focus (widget))
return FALSE;
+ gtk_widget_get_allocation (widget, &allocation);
+
/*
* We are deliberately ignoring focus-padding here to
* save valuable panel real estate.
@@ -1232,16 +1245,17 @@ panel_applet_expose (GtkWidget *widget,
"focus-line-width", &focus_width,
NULL);
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- x = widget->allocation.x;
- y = widget->allocation.y;
+ x = allocation.x;
+ y = allocation.y;
- width = widget->allocation.width - 2 * border_width;
- height = widget->allocation.height - 2 * border_width;
+ width = allocation.width - 2 * border_width;
+ height = allocation.height - 2 * border_width;
- gtk_paint_focus (widget->style, widget->window,
- GTK_WIDGET_STATE (widget),
+ gtk_paint_focus (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
+ gtk_widget_get_state (widget),
&event->area, widget, "panel_applet",
x, y, width, height);
@@ -1268,12 +1282,12 @@ panel_applet_focus (GtkWidget *widget,
return FALSE;
}
- previous_focus_child = GTK_CONTAINER (widget)->focus_child;
+ previous_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget));
if (!previous_focus_child && !gtk_widget_has_focus (widget)) {
if (gtk_widget_get_has_tooltip (widget)) {
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_grab_focus (widget);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (widget, FALSE);
return TRUE;
}
}
@@ -1286,9 +1300,9 @@ panel_applet_focus (GtkWidget *widget,
* the focus on the applet unless it already had focus
* because it had a tooltip.
*/
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_grab_focus (widget);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (widget, FALSE);
ret = TRUE;
}
}
@@ -1368,6 +1382,7 @@ panel_applet_get_pixmap (PanelApplet *applet,
GdkPixmap *pixmap;
GdkDisplay *display;
GdkPixmap *retval;
+ GdkWindow *window;
int width;
int height;
cairo_t *cr;
@@ -1381,6 +1396,8 @@ panel_applet_get_pixmap (PanelApplet *applet,
display = gdk_display_get_default ();
display_grabbed = FALSE;
+ window = gtk_widget_get_window (GTK_WIDGET (applet));
+
pixmap = gdk_pixmap_lookup_for_display (display, xid);
if (pixmap)
g_object_ref (pixmap);
@@ -1398,14 +1415,12 @@ panel_applet_get_pixmap (PanelApplet *applet,
return NULL;
}
- gdk_drawable_get_size (GDK_DRAWABLE (GTK_WIDGET (applet)->window),
- &width, &height);
- retval = gdk_pixmap_new (GTK_WIDGET (applet)->window,
- width, height, -1);
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+ retval = gdk_pixmap_new (window, width, height, -1);
/* the pixmap has no colormap, and we need one */
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap),
- gdk_drawable_get_colormap (GTK_WIDGET (applet)->window));
+ gdk_drawable_get_colormap (window));
cr = gdk_cairo_create (GDK_DRAWABLE (retval));
gdk_cairo_set_source_pixmap (cr, pixmap, -x, -y);
@@ -1541,7 +1556,7 @@ panel_applet_update_background_for_widget (GtkWidget *widget,
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
break;
case PANEL_PIXMAP_BACKGROUND:
- style = gtk_style_copy (widget->style);
+ 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);
diff --git a/libpanel-applet/test-dbus-applet.c b/libpanel-applet/test-dbus-applet.c
index ebad238..4f14b2a 100644
--- a/libpanel-applet/test-dbus-applet.c
+++ b/libpanel-applet/test-dbus-applet.c
@@ -116,19 +116,21 @@ test_applet_handle_background_change (TestApplet *applet,
GdkPixmap *pixmap,
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 (applet->label->window, NULL, FALSE);
+ 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 (applet->label->window, NULL, FALSE);
+ 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 (applet->label->window, pixmap, FALSE);
+ gdk_window_set_back_pixmap (window, pixmap, FALSE);
break;
default:
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]