[libwnck] [all] Start fixing the build with GSEAL_ENABLED
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck] [all] Start fixing the build with GSEAL_ENABLED
- Date: Wed, 10 Mar 2010 22:26:56 +0000 (UTC)
commit 0ffea2f07010079b86bfe98994c0920e1599d313
Author: Vincent Untz <vuntz gnome org>
Date: Wed Mar 10 23:25:12 2010 +0100
[all] Start fixing the build with GSEAL_ENABLED
The changes are really straightforward here, it's just some work that
takes time.
Part of https://bugzilla.gnome.org/show_bug.cgi?id=612490
libwnck/pager.c | 188 +++++++++++++++++++++++++--------------
libwnck/selector.c | 41 ++++++---
libwnck/tasklist.c | 201 ++++++++++++++++++++++++++++--------------
libwnck/util.c | 2 +-
libwnck/window-action-menu.c | 10 ++-
5 files changed, 287 insertions(+), 155 deletions(-)
---
diff --git a/libwnck/pager.c b/libwnck/pager.c
index 34e3974..2398c27 100644
--- a/libwnck/pager.c
+++ b/libwnck/pager.c
@@ -233,7 +233,7 @@ wnck_pager_init (WnckPager *pager)
g_object_set (pager, "has-tooltip", TRUE, NULL);
gtk_drag_dest_set (GTK_WIDGET (pager), 0, targets, G_N_ELEMENTS (targets), GDK_ACTION_MOVE);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (pager), GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (pager), TRUE);
}
static void
@@ -330,18 +330,24 @@ wnck_pager_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
WnckPager *pager;
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GtkStyle *style;
+ GtkStyle *new_style;
pager = WNCK_PAGER (widget);
/* do not call the parent class realize since we're doing things a bit
* differently here */
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
+
+ gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
@@ -352,11 +358,20 @@ wnck_pager_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
+
+ style = gtk_widget_get_style (widget);
+
+ new_style = gtk_style_attach (style, window);
+ if (new_style != style)
+ {
+ gtk_widget_set_style (widget, style);
+ style = new_style;
+ }
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_style_set_background (style, window, GTK_STATE_NORMAL);
/* connect to the screen of this pager. In theory, this will already have
* been done in wnck_pager_size_request() */
@@ -503,8 +518,12 @@ wnck_pager_size_request (GtkWidget *widget,
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- requisition->width += 2 * widget->style->xthickness;
- requisition->height += 2 * widget->style->ythickness;
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
+ requisition->width += 2 * style->xthickness;
+ requisition->height += 2 * style->ythickness;
}
gtk_widget_style_get (widget,
@@ -536,8 +555,12 @@ wnck_pager_size_allocate (GtkWidget *widget,
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- width -= 2 * widget->style->xthickness;
- height -= 2 * widget->style->ythickness;
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
+ width -= 2 * style->xthickness;
+ height -= 2 * style->ythickness;
}
g_assert (pager->priv->n_rows > 0);
@@ -578,14 +601,19 @@ get_workspace_rect (WnckPager *pager,
int spaces_per_row;
GtkWidget *widget;
int col, row;
+ GtkAllocation allocation;
+ GtkStyle *style;
int focus_width;
- gtk_widget_style_get (GTK_WIDGET (pager),
+ widget = GTK_WIDGET (pager);
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ style = gtk_widget_get_style (widget);
+ gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
NULL);
- widget = GTK_WIDGET (pager);
-
if (!pager->priv->show_all_workspaces)
{
WnckWorkspace *active_space;
@@ -596,15 +624,15 @@ get_workspace_rect (WnckPager *pager,
{
rect->x = focus_width;
rect->y = focus_width;
- rect->width = widget->allocation.width - 2 * focus_width;
- rect->height = widget->allocation.height - 2 * focus_width;
+ rect->width = allocation.width - 2 * focus_width;
+ rect->height = allocation.height - 2 * focus_width;
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- rect->x += widget->style->xthickness;
- rect->y += widget->style->ythickness;
- rect->width -= 2 * widget->style->xthickness;
- rect->height -= 2 * widget->style->ythickness;
+ rect->x += style->xthickness;
+ rect->y += style->ythickness;
+ rect->width -= 2 * style->xthickness;
+ rect->height -= 2 * style->ythickness;
}
}
else
@@ -618,13 +646,13 @@ get_workspace_rect (WnckPager *pager,
return;
}
- hsize = widget->allocation.width - 2 * focus_width;
- vsize = widget->allocation.height - 2 * focus_width;
+ hsize = allocation.width - 2 * focus_width;
+ vsize = allocation.height - 2 * focus_width;
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- hsize -= 2 * widget->style->xthickness;
- vsize -= 2 * widget->style->ythickness;
+ hsize -= 2 * style->xthickness;
+ vsize -= 2 * style->ythickness;
}
n_spaces = wnck_screen_get_workspace_count (pager->priv->screen);
@@ -678,8 +706,8 @@ get_workspace_rect (WnckPager *pager,
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- rect->x += widget->style->xthickness;
- rect->y += widget->style->ythickness;
+ rect->x += style->xthickness;
+ rect->y += style->ythickness;
}
}
@@ -782,6 +810,7 @@ draw_window (GdkDrawable *drawable,
GtkStateType state,
gboolean translucent)
{
+ GtkStyle *style;
cairo_t *cr;
GdkPixbuf *icon;
int icon_x, icon_y, icon_w, icon_h;
@@ -789,6 +818,8 @@ draw_window (GdkDrawable *drawable,
GdkColor *color;
gdouble translucency;
+ style = gtk_widget_get_style (widget);
+
is_active = wnck_window_is_active (win);
translucency = translucent ? 0.4 : 1.0;
@@ -797,9 +828,9 @@ draw_window (GdkDrawable *drawable,
cairo_clip (cr);
if (is_active)
- color = &widget->style->light[state];
+ color = &style->light[state];
else
- color = &widget->style->bg[state];
+ color = &style->bg[state];
cairo_set_source_rgba (cr,
color->red / 65535.,
color->green / 65535.,
@@ -854,9 +885,9 @@ draw_window (GdkDrawable *drawable,
}
if (is_active)
- color = &widget->style->fg[state];
+ color = &style->fg[state];
else
- color = &widget->style->fg[state];
+ color = &style->fg[state];
cairo_set_source_rgba (cr,
color->red / 65535.,
color->green / 65535.,
@@ -920,20 +951,27 @@ workspace_at_point (WnckPager *pager,
GtkWidget *widget;
int i;
int n_spaces;
+ GtkAllocation allocation;
int focus_width;
int xthickness;
int ythickness;
widget = GTK_WIDGET (pager);
+ gtk_widget_get_allocation (widget, &allocation);
+
gtk_widget_style_get (GTK_WIDGET (pager),
"focus-line-width", &focus_width,
NULL);
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- xthickness = focus_width + widget->style->xthickness;
- ythickness = focus_width + widget->style->ythickness;
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
+ xthickness = focus_width + style->xthickness;
+ ythickness = focus_width + style->ythickness;
}
else
{
@@ -947,7 +985,6 @@ workspace_at_point (WnckPager *pager,
while (i < n_spaces)
{
GdkRectangle rect;
- GtkWidget *widget;
get_workspace_rect (pager, i, &rect);
@@ -956,7 +993,6 @@ workspace_at_point (WnckPager *pager,
* Else, pretend the right/bottom line separating two workspaces belong
* to the workspace.
*/
- widget = GTK_WIDGET (pager);
if (rect.x == xthickness)
{
@@ -968,7 +1004,7 @@ workspace_at_point (WnckPager *pager,
rect.y = 0;
rect.height += ythickness;
}
- if (rect.y + rect.height == widget->allocation.height - ythickness)
+ if (rect.y + rect.height == allocation.height - ythickness)
{
rect.height += ythickness;
}
@@ -976,7 +1012,7 @@ workspace_at_point (WnckPager *pager,
{
rect.height += 1;
}
- if (rect.x + rect.width == widget->allocation.width - xthickness)
+ if (rect.x + rect.width == allocation.width - xthickness)
{
rect.width += xthickness;
}
@@ -1025,6 +1061,8 @@ wnck_pager_draw_workspace (WnckPager *pager,
WnckWorkspace *space;
GtkWidget *widget;
GtkStateType state;
+ GdkWindow *window;
+ GtkStyle *style;
space = wnck_screen_get_workspace (pager->priv->screen, workspace);
if (!space)
@@ -1040,13 +1078,16 @@ wnck_pager_draw_workspace (WnckPager *pager,
else
state = GTK_STATE_NORMAL;
+ window = gtk_widget_get_window (widget);
+ style = gtk_widget_get_style (widget);
+
/* FIXME in names mode, should probably draw things like a button.
*/
if (bg_pixbuf)
{
- gdk_draw_pixbuf (widget->window,
- widget->style->dark_gc[state],
+ gdk_draw_pixbuf (window,
+ style->dark_gc[state],
bg_pixbuf,
0, 0,
rect->x, rect->y,
@@ -1058,11 +1099,11 @@ wnck_pager_draw_workspace (WnckPager *pager,
{
cairo_t *cr;
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (window);
if (!wnck_workspace_is_virtual (space))
{
- gdk_cairo_set_source_color (cr, &widget->style->dark[state]);
+ gdk_cairo_set_source_color (cr, &style->dark[state]);
cairo_rectangle (cr, rect->x, rect->y, rect->width, rect->height);
cairo_fill (cr);
}
@@ -1131,10 +1172,10 @@ wnck_pager_draw_workspace (WnckPager *pager,
if (active_i == i && active_j == j)
gdk_cairo_set_source_color (cr,
- &widget->style->dark[GTK_STATE_SELECTED]);
+ &style->dark[GTK_STATE_SELECTED]);
else
gdk_cairo_set_source_color (cr,
- &widget->style->dark[GTK_STATE_NORMAL]);
+ &style->dark[GTK_STATE_NORMAL]);
cairo_rectangle (cr, vx, vy, vw, vh);
cairo_fill (cr);
}
@@ -1146,7 +1187,7 @@ wnck_pager_draw_workspace (WnckPager *pager,
height_ratio = rect->height / (double) workspace_height;
/* first draw non-active part of the viewport */
- gdk_cairo_set_source_color (cr, &widget->style->dark[GTK_STATE_NORMAL]);
+ gdk_cairo_set_source_color (cr, &style->dark[GTK_STATE_NORMAL]);
cairo_rectangle (cr, rect->x, rect->y, rect->width, rect->height);
cairo_fill (cr);
@@ -1160,7 +1201,7 @@ wnck_pager_draw_workspace (WnckPager *pager,
vw = width_ratio * screen_width;
vh = height_ratio * screen_height;
- gdk_cairo_set_source_color (cr, &widget->style->dark[GTK_STATE_SELECTED]);
+ gdk_cairo_set_source_color (cr, &style->dark[GTK_STATE_SELECTED]);
cairo_rectangle (cr, vx, vy, vw, vh);
cairo_fill (cr);
}
@@ -1184,7 +1225,7 @@ wnck_pager_draw_workspace (WnckPager *pager,
get_window_rect (win, rect, &winrect);
- draw_window (widget->window,
+ draw_window (window,
widget,
win,
&winrect,
@@ -1210,10 +1251,10 @@ wnck_pager_draw_workspace (WnckPager *pager,
pango_layout_get_pixel_size (layout, &w, &h);
- gdk_draw_layout (widget->window,
+ gdk_draw_layout (window,
is_current ?
- widget->style->fg_gc[GTK_STATE_SELECTED] :
- widget->style->fg_gc[GTK_STATE_NORMAL],
+ style->fg_gc[GTK_STATE_SELECTED] :
+ style->fg_gc[GTK_STATE_NORMAL],
rect->x + (rect->width - w) / 2,
rect->y + (rect->height - h) / 2,
layout);
@@ -1225,12 +1266,12 @@ wnck_pager_draw_workspace (WnckPager *pager,
{
/* stolen directly from gtk source so it matches nicely */
cairo_t *cr;
- gtk_paint_shadow (widget->style, widget->window,
+ gtk_paint_shadow (style, window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, widget, "dnd",
rect->x, rect->y, rect->width, rect->height);
- cr = gdk_cairo_create (widget->window);
+ cr = gdk_cairo_create (window);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
@@ -1251,6 +1292,9 @@ wnck_pager_expose_event (GtkWidget *widget,
WnckWorkspace *active_space;
GdkPixbuf *bg_pixbuf;
gboolean first;
+ GdkWindow *window;
+ GtkAllocation allocation;
+ GtkStyle *style;
int focus_width;
pager = WNCK_PAGER (widget);
@@ -1260,34 +1304,38 @@ wnck_pager_expose_event (GtkWidget *widget,
bg_pixbuf = NULL;
first = TRUE;
+ window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ style = gtk_widget_get_style (widget);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
NULL);
if (gtk_widget_has_focus (widget))
- gtk_paint_focus (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
+ gtk_paint_focus (style,
+ window,
+ gtk_widget_get_state (widget),
NULL,
widget,
"pager",
0, 0,
- widget->allocation.width,
- widget->allocation.height);
+ allocation.width,
+ allocation.height);
if (pager->priv->shadow_type != GTK_SHADOW_NONE)
{
- gtk_paint_shadow (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
+ gtk_paint_shadow (style,
+ window,
+ gtk_widget_get_state (widget),
pager->priv->shadow_type,
NULL,
widget,
"pager",
focus_width,
focus_width,
- widget->allocation.width - 2 * focus_width,
- widget->allocation.height - 2 * focus_width);
+ allocation.width - 2 * focus_width,
+ allocation.height - 2 * focus_width);
}
i = 0;
@@ -1519,8 +1567,8 @@ wnck_pager_drag_data_received (GtkWidget *widget,
gint i;
gulong xid;
- if ((selection_data->length != sizeof (gulong)) ||
- (selection_data->format != 8))
+ if ((gtk_selection_data_get_length (selection_data) != sizeof (gulong)) ||
+ (gtk_selection_data_get_format (selection_data) != 8))
{
gtk_drag_finish (context, FALSE, FALSE, time);
return;
@@ -1534,7 +1582,7 @@ wnck_pager_drag_data_received (GtkWidget *widget,
return;
}
- xid = *((gulong *)selection_data->data);
+ xid = *((gulong *) gtk_selection_data_get_data (selection_data));
for (tmp = wnck_screen_get_windows_stacked (pager->priv->screen); tmp != NULL; tmp = tmp->next)
{
@@ -1567,7 +1615,7 @@ wnck_pager_drag_data_get (GtkWidget *widget,
xid = wnck_window_get_xid (pager->priv->drag_window);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ gtk_selection_data_get_target (selection_data),
8, (guchar *)&xid, sizeof (gulong));
}
@@ -1646,7 +1694,7 @@ wnck_update_drag_icon (WnckWindow *window,
rect.width = MAX (rect.width, 3);
rect.height = MAX (rect.height, 3);
- pixmap = gdk_pixmap_new (GTK_WIDGET (widget)->window,
+ pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
rect.width, rect.height, -1);
draw_window (GDK_DRAWABLE (pixmap), widget, window,
&rect, GTK_STATE_NORMAL, FALSE);
@@ -1743,11 +1791,13 @@ wnck_pager_motion (GtkWidget *widget,
GdkEventMotion *event)
{
WnckPager *pager;
+ GdkWindow *window;
int x, y;
pager = WNCK_PAGER (widget);
- gdk_window_get_pointer (widget->window, &x, &y, NULL);
+ window = gtk_widget_get_window (widget);
+ gdk_window_get_pointer (window, &x, &y, NULL);
if (!pager->priv->dragging &&
pager->priv->drag_window != NULL &&
diff --git a/libwnck/selector.c b/libwnck/selector.c
index f154494..fb99236 100644
--- a/libwnck/selector.c
+++ b/libwnck/selector.c
@@ -244,7 +244,7 @@ wnck_selector_set_active_window (WnckSelector *selector, WnckWindow *window)
static void
wnck_selector_make_menu_consistent (WnckSelector *selector)
{
- GList *l;
+ GList *l, *children;
int workspace_n;
GtkWidget *workspace_item;
GtkWidget *separator;
@@ -261,7 +261,9 @@ wnck_selector_make_menu_consistent (WnckSelector *selector)
visible_window = FALSE;
- for (l = GTK_MENU_SHELL (selector->priv->menu)->children; l; l = l->next)
+ children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
+
+ for (l = children; l; l = l->next)
{
int i;
@@ -315,6 +317,8 @@ wnck_selector_make_menu_consistent (WnckSelector *selector)
} /* end if (normal item) */
}
+ g_list_free (children);
+
/* do we have a trailing workspace item to be hidden? */
if (workspace_item)
gtk_widget_hide (workspace_item);
@@ -505,6 +509,7 @@ wnck_selector_activate_window (WnckWindow *window)
static gint
wnck_selector_get_width (GtkWidget *widget, const char *text)
{
+ GtkStyle *style;
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width;
@@ -515,9 +520,10 @@ wnck_selector_get_width (GtkWidget *widget, const char *text)
gint width;
gtk_widget_ensure_style (widget);
+ style = gtk_widget_get_style (widget);
context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context, widget->style->font_desc,
+ metrics = pango_context_get_metrics (context, style->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
@@ -548,7 +554,7 @@ wnck_selector_drag_begin (GtkWidget *widget,
if (GTK_IS_MENU (widget))
widget = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
- widget = widget->parent;
+ widget = gtk_widget_get_parent (widget);
}
if (widget)
@@ -567,7 +573,7 @@ wnck_selector_drag_data_get (GtkWidget *widget,
xid = wnck_window_get_xid (window);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ gtk_selection_data_get_target (selection_data),
8, (guchar *)&xid, sizeof (gulong));
}
@@ -644,11 +650,13 @@ static void
wnck_selector_workspace_name_changed (WnckWorkspace *workspace,
GtkLabel *label)
{
+ GtkStyle *style;
GdkColor *color;
char *name;
char *markup;
- color = >K_WIDGET (label)->style->fg[GTK_STATE_INSENSITIVE];
+ style = gtk_widget_get_style (GTK_WIDGET (label));
+ color = &style->fg[GTK_STATE_INSENSITIVE];
name = g_markup_escape_text (wnck_workspace_get_name (workspace), -1);
markup = g_strdup_printf ("<span size=\"x-small\" style=\"italic\" foreground=\"#%.2x%.2x%.2x\">%s</span>",
@@ -761,16 +769,18 @@ wnck_selector_insert_window (WnckSelector *selector, WnckWindow *window)
{
/* window is pinned or in the current workspace
* => insert before the separator */
- GList *l;
+ GList *l, *children;
i = 0;
- for (l = GTK_MENU_SHELL (selector->priv->menu)->children; l; l = l->next)
+ children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
+ for (l = children; l; l = l->next)
{
if (GTK_IS_SEPARATOR_MENU_ITEM (l->data))
break;
i++;
}
+ g_list_free (children);
gtk_menu_shell_insert (GTK_MENU_SHELL (selector->priv->menu),
item, i);
@@ -785,12 +795,12 @@ wnck_selector_insert_window (WnckSelector *selector, WnckWindow *window)
else
{
/* insert just before the next workspace item */
- GList *l;
+ GList *l, *children;
i = 0;
- for (l = GTK_MENU_SHELL (selector->priv->menu)->children;
- l; l = l->next)
+ children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
+ for (l = children; l; l = l->next)
{
int j;
j = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (l->data),
@@ -799,6 +809,7 @@ wnck_selector_insert_window (WnckSelector *selector, WnckWindow *window)
break;
i++;
}
+ g_list_free (children);
gtk_menu_shell_insert (GTK_MENU_SHELL (selector->priv->menu),
item, i);
@@ -884,7 +895,7 @@ wnck_selector_workspace_destroyed (WnckScreen *screen,
WnckWorkspace *workspace,
WnckSelector *selector)
{
- GList *l;
+ GList *l, *children;
GtkWidget *destroy;
int i;
@@ -896,7 +907,9 @@ wnck_selector_workspace_destroyed (WnckScreen *screen,
i = wnck_workspace_get_number (workspace);
/* search for the item of this workspace so that we destroy it */
- for (l = GTK_MENU_SHELL (selector->priv->menu)->children; l; l = l->next)
+ children = gtk_container_get_children (GTK_CONTAINER (selector->priv->menu));
+
+ for (l = children; l; l = l->next)
{
int j;
@@ -912,6 +925,8 @@ wnck_selector_workspace_destroyed (WnckScreen *screen,
GINT_TO_POINTER (j - 1));
}
+ g_list_free (children);
+
if (destroy)
gtk_widget_destroy (destroy);
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index cf1dcfb..9906a0b 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -458,6 +458,8 @@ wnck_task_button_glow (WnckTask *task)
gfloat fade_opacity, loop_time;
gint fade_max_loops;
gboolean stopped;
+ GdkWindow *window;
+ GtkAllocation allocation;
cairo_t *cr;
if (task->screenshot == NULL)
@@ -493,12 +495,14 @@ wnck_task_button_glow (WnckTask *task)
stopped = FALSE;
}
- gdk_window_begin_paint_rect (task->button->window,
- &task->button->allocation);
+ window = gtk_widget_get_window (task->button);
+ gtk_widget_get_allocation (task->button, &allocation);
- cr = gdk_cairo_create (task->button->window);
- gdk_cairo_rectangle (cr, &task->button->allocation);
- cairo_translate (cr, task->button->allocation.x, task->button->allocation.y);
+ gdk_window_begin_paint_rect (window, &allocation);
+
+ cr = gdk_cairo_create (window);
+ gdk_cairo_rectangle (cr, &allocation);
+ cairo_translate (cr, allocation.x, allocation.y);
cairo_clip (cr);
cairo_save (cr);
@@ -515,7 +519,7 @@ wnck_task_button_glow (WnckTask *task)
cairo_destroy (cr);
- gdk_window_end_paint (task->button->window);
+ gdk_window_end_paint (window);
if (stopped)
wnck_task_stop_glow (task);
@@ -669,7 +673,7 @@ wnck_tasklist_init (WnckTasklist *tasklist)
widget = GTK_WIDGET (tasklist);
- GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (widget, FALSE);
tasklist->priv = WNCK_TASKLIST_GET_PRIVATE (tasklist);
@@ -1260,6 +1264,7 @@ wnck_task_get_highest_scored (GList *ungrouped_class_groups,
static int
wnck_tasklist_get_button_size (GtkWidget *widget)
{
+ GtkStyle *style;
PangoContext *context;
PangoFontMetrics *metrics;
gint char_width;
@@ -1267,9 +1272,10 @@ wnck_tasklist_get_button_size (GtkWidget *widget)
gint width;
gtk_widget_ensure_style (widget);
+ style = gtk_widget_get_style (widget);
context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context, widget->style->font_desc,
+ metrics = pango_context_get_metrics (context, style->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
@@ -1287,6 +1293,7 @@ wnck_tasklist_size_request (GtkWidget *widget,
{
WnckTasklist *tasklist;
GtkRequisition child_req;
+ GtkAllocation tasklist_allocation;
GtkAllocation fake_allocation;
int max_height = 1;
int max_width = 1;
@@ -1337,8 +1344,10 @@ wnck_tasklist_size_request (GtkWidget *widget,
tasklist->priv->max_button_width = wnck_tasklist_get_button_size (widget);
tasklist->priv->max_button_height = max_height;
- fake_allocation.width = GTK_WIDGET (tasklist)->allocation.width;
- fake_allocation.height = GTK_WIDGET (tasklist)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (tasklist), &tasklist_allocation);
+
+ fake_allocation.width = tasklist_allocation.width;
+ fake_allocation.height = tasklist_allocation.height;
array = g_array_new (FALSE, FALSE, sizeof (int));
@@ -1470,10 +1479,13 @@ wnck_task_size_allocated (GtkWidget *widget,
gpointer data)
{
WnckTask *task = WNCK_TASK (data);
+ GtkStyle *style;
int min_image_width;
+ style = gtk_widget_get_style (widget);
+
min_image_width = MINI_ICON_SIZE +
- 2 * widget->style->xthickness +
+ 2 * style->xthickness +
2 * TASKLIST_BUTTON_PADDING;
if ((allocation->width < min_image_width + 2 * TASKLIST_BUTTON_PADDING) &&
@@ -1743,20 +1755,26 @@ wnck_tasklist_expose (GtkWidget *widget,
if (gtk_widget_is_drawable (widget))
{
+ GdkWindow *window;
+ GtkAllocation allocation;
+
+ window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
tasklist = WNCK_TASKLIST (widget);
/* get a screenshot of the background */
if (tasklist->priv->background != NULL)
g_object_unref (tasklist->priv->background);
- tasklist->priv->background = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
+ tasklist->priv->background = gdk_pixmap_new (window,
+ allocation.width,
+ allocation.height,
-1);
gc = gdk_gc_new (tasklist->priv->background);
- gdk_draw_drawable (tasklist->priv->background, gc, widget->window,
- widget->allocation.x, widget->allocation.y, 0, 0,
- widget->allocation.width, widget->allocation.height);
+ gdk_draw_drawable (tasklist->priv->background, gc, window,
+ allocation.x, allocation.y, 0, 0,
+ allocation.width, allocation.height);
g_object_unref (gc);
}
@@ -2250,6 +2268,7 @@ wnck_tasklist_include_window (WnckTasklist *tasklist, WnckWindow *win)
static void
wnck_tasklist_update_lists (WnckTasklist *tasklist)
{
+ GdkWindow *tasklist_window;
GList *windows;
WnckWindow *win;
WnckClassGroup *class_group;
@@ -2263,7 +2282,9 @@ wnck_tasklist_update_lists (WnckTasklist *tasklist)
if (!gtk_widget_get_realized (GTK_WIDGET (tasklist)))
return;
- if (GTK_WIDGET (tasklist)->window != NULL)
+ tasklist_window = gtk_widget_get_window (GTK_WIDGET (tasklist));
+
+ if (tasklist_window != NULL)
{
/*
* only show windows from this monitor if there is more than one tasklist running
@@ -2277,7 +2298,7 @@ wnck_tasklist_update_lists (WnckTasklist *tasklist)
int monitor_num;
monitor_num = gdk_screen_get_monitor_at_window (_wnck_screen_get_gdk_screen (tasklist->priv->screen),
- GTK_WIDGET (tasklist)->window);
+ tasklist_window);
if (monitor_num != tasklist->priv->monitor_num)
{
@@ -2445,14 +2466,17 @@ wnck_tasklist_update_icon_geometries (WnckTasklist *tasklist,
for (l1 = visible_tasks; l1; l1 = l1->next) {
WnckTask *task = WNCK_TASK (l1->data);
+ GtkAllocation allocation;
if (!gtk_widget_get_realized (task->button))
continue;
+ gtk_widget_get_allocation (task->button, &allocation);
+
gdk_window_get_origin (GTK_BUTTON (task->button)->event_window,
&x, &y);
- width = task->button->allocation.width;
- height = task->button->allocation.height;
+ width = allocation.width;
+ height = allocation.height;
if (task->window)
wnck_window_set_icon_geometry (task->window,
@@ -2561,6 +2585,7 @@ static void
wnck_tasklist_window_changed_geometry (WnckWindow *window,
WnckTasklist *tasklist)
{
+ GdkWindow *tasklist_window;
WnckTask *win_task;
gboolean show;
gboolean monitor_changed;
@@ -2569,6 +2594,8 @@ wnck_tasklist_window_changed_geometry (WnckWindow *window,
if (tasklist->priv->idle_callback_tag != 0)
return;
+ tasklist_window = gtk_widget_get_window (GTK_WIDGET (tasklist));
+
/*
* If the (parent of the) tasklist itself skips
* the tasklist, we need an extra check whether
@@ -2577,14 +2604,14 @@ wnck_tasklist_window_changed_geometry (WnckWindow *window,
monitor_changed = FALSE;
if (tasklist->priv->monitor_num != -1 &&
(wnck_window_get_state (window) & WNCK_WINDOW_STATE_SKIP_TASKLIST) &&
- GTK_WIDGET (tasklist)->window != NULL)
+ tasklist_window != NULL)
{
/* Do the extra check only if there is a suspect of a monitor change (= this window is off monitor) */
wnck_window_get_geometry (window, &x, &y, &w, &h);
if (!POINT_IN_RECT (x + w / 2, y + h / 2, tasklist->priv->monitor_geometry))
{
monitor_changed = (gdk_screen_get_monitor_at_window (_wnck_screen_get_gdk_screen (tasklist->priv->screen),
- GTK_WIDGET (tasklist)->window) != tasklist->priv->monitor_num);
+ tasklist_window) != tasklist->priv->monitor_num);
}
}
@@ -2670,6 +2697,8 @@ wnck_task_position_menu (GtkMenu *menu,
gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (user_data);
+ GdkWindow *window;
+ GtkAllocation allocation;
GtkRequisition requisition;
gint menu_xpos;
gint menu_ypos;
@@ -2678,19 +2707,22 @@ wnck_task_position_menu (GtkMenu *menu,
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
- gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
+ window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gdk_window_get_origin (window, &menu_xpos, &menu_ypos);
- menu_xpos += widget->allocation.x;
- menu_ypos += widget->allocation.y;
+ menu_xpos += allocation.x;
+ menu_ypos += allocation.y;
if (menu_ypos > gdk_screen_height () / 2)
menu_ypos -= requisition.height;
else
- menu_ypos += widget->allocation.height;
+ menu_ypos += allocation.height;
gtk_widget_get_pointer (widget, &pointer_x, &pointer_y);
if (requisition.width < pointer_x)
- menu_xpos += MIN (pointer_x, widget->allocation.width - requisition.width);
+ menu_xpos += MIN (pointer_x, allocation.width - requisition.width);
*x = menu_xpos;
*y = menu_ypos;
@@ -2955,7 +2987,7 @@ wnck_task_popup_menu (WnckTask *task,
TRUE);
if (wnck_task_get_needs_attention (win_task))
- _make_gtk_label_bold (GTK_LABEL (GTK_BIN (menu_item)->child));
+ _make_gtk_label_bold (GTK_LABEL (gtk_bin_get_child (GTK_BIN (menu_item))));
text = wnck_task_get_text (win_task, FALSE, FALSE);
gtk_widget_set_tooltip_text (menu_item, text);
@@ -3575,7 +3607,7 @@ wnck_task_drag_data_get (GtkWidget *widget,
xid = wnck_window_get_xid (task->window);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ gtk_selection_data_get_target (selection_data),
8, (guchar *)&xid, sizeof (gulong));
}
@@ -3596,14 +3628,15 @@ wnck_task_drag_data_received (GtkWidget *widget,
guint new_order, old_order, order;
WnckWindow *found_window;
- if ((data->length != sizeof (gulong)) || (data->format != 8))
+ if ((gtk_selection_data_get_length (data) != sizeof (gulong)) ||
+ (gtk_selection_data_get_format (data) != 8))
{
gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
tasklist = target_task->tasklist;
- xid = (gulong *)data->data;
+ xid = (gulong *) gtk_selection_data_get_data (data);
found_window = NULL;
new_order = 0;
windows = wnck_screen_get_windows (tasklist->priv->screen);
@@ -3920,6 +3953,7 @@ fake_expose_widget (GtkWidget *widget,
{
GdkWindow *tmp_window;
GdkEventExpose event;
+ GtkAllocation allocation;
event.type = GDK_EXPOSE;
event.window = pixmap;
@@ -3927,33 +3961,45 @@ fake_expose_widget (GtkWidget *widget,
event.region = NULL;
event.count = 0;
- tmp_window = widget->window;
+ tmp_window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ /* FIXME GSeal: we should use this:
+ gtk_widget_set_window (widget, pixmap);
+ but pixmap is not a GdkWindow...
+ */
widget->window = pixmap;
- widget->allocation.x += x;
- widget->allocation.y += y;
+ allocation.x += x;
+ allocation.y += y;
+ gtk_widget_set_allocation (widget, &allocation);
- event.area = widget->allocation;
+ event.area = allocation;
gtk_widget_send_expose (widget, (GdkEvent *) &event);
- widget->window = tmp_window;
- widget->allocation.x -= x;
- widget->allocation.y -= y;
+ gtk_widget_set_window (widget, tmp_window);
+ allocation.x -= x;
+ allocation.y -= y;
+ gtk_widget_set_allocation (widget, &allocation);
}
static GdkPixmap *
take_screenshot (WnckTask *task)
{
+ GtkAllocation allocation;
WnckTasklist *tasklist;
GtkWidget *tasklist_widget;
GdkPixmap *pixmap;
gint width, height;
gboolean overlay_rect;
+
+ gtk_widget_get_allocation (task->button, &allocation);
- width = task->button->allocation.width;
- height = task->button->allocation.height;
+ width = allocation.width;
+ height = allocation.height;
- pixmap = gdk_pixmap_new (task->button->window, width, height, -1);
+ pixmap = gdk_pixmap_new (gtk_widget_get_window (task->button),
+ width, height, -1);
tasklist = WNCK_TASKLIST (task->tasklist);
tasklist_widget = GTK_WIDGET (task->tasklist);
@@ -3962,18 +4008,25 @@ take_screenshot (WnckTask *task)
gtk_widget_style_get (tasklist_widget, "fade-overlay-rect", &overlay_rect, NULL);
if (overlay_rect)
{
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (task->button);
+
/* Draw a rectangle with bg[SELECTED] */
- gdk_draw_rectangle (pixmap, task->button->style->bg_gc[GTK_STATE_SELECTED],
+ gdk_draw_rectangle (pixmap, style->bg_gc[GTK_STATE_SELECTED],
TRUE, 0, 0, width + 1, height + 1);
}
else
{
- GtkStyle *style;
- GtkStyle *attached_style;
-
+ GtkStateType state;
+ GtkStyle *style;
+ GtkStyle *attached_style;
+
+ state = gtk_widget_get_state (task->button);
+
/* copy the style to change its colors around. */
- style = gtk_style_copy (task->button->style);
- style->bg[task->button->state] = style->bg[GTK_STATE_SELECTED];
+ style = gtk_style_copy (gtk_widget_get_style (task->button));
+ style->bg[state] = style->bg[GTK_STATE_SELECTED];
/* Now attach it to the window */
attached_style = gtk_style_attach (style, pixmap);
g_object_ref (attached_style);
@@ -3981,11 +4034,11 @@ take_screenshot (WnckTask *task)
/* copy the background */
gdk_draw_drawable (pixmap, attached_style->bg_gc[GTK_STATE_NORMAL],
tasklist->priv->background,
- task->button->allocation.x, task->button->allocation.y,
+ allocation.x, allocation.y,
0, 0, width, height);
/* draw the button with our modified style instead of the real one. */
- gtk_paint_box (attached_style, (GdkWindow*) pixmap, task->button->state,
+ gtk_paint_box (attached_style, (GdkWindow*) pixmap, state,
GTK_SHADOW_OUT, NULL, task->button, "button",
0, 0, width, height);
@@ -3996,9 +4049,9 @@ take_screenshot (WnckTask *task)
/* then the image and label */
fake_expose_widget (task->image, pixmap,
- -task->button->allocation.x, -task->button->allocation.y);
+ -allocation.x, -allocation.y);
fake_expose_widget (task->label, pixmap,
- -task->button->allocation.x, -task->button->allocation.y);
+ -allocation.x, -allocation.y);
return pixmap;
}
@@ -4006,18 +4059,25 @@ take_screenshot (WnckTask *task)
static GdkPixmap *
copy_pixmap (GtkWidget *widget)
{
+ GdkWindow *window;
+ GtkAllocation allocation;
GdkPixmap *pixmap;
+ GtkStyle *style;
+
+ window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+ style = gtk_widget_get_style (widget);
- pixmap = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height, -1);
+ pixmap = gdk_pixmap_new (window,
+ allocation.width,
+ allocation.height, -1);
gdk_draw_drawable (pixmap,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- widget->window,
- widget->allocation.x, widget->allocation.y,
+ style->bg_gc[GTK_STATE_NORMAL],
+ window,
+ allocation.x, allocation.y,
0, 0,
- widget->allocation.width, widget->allocation.height);
+ allocation.width, allocation.height);
return pixmap;
}
@@ -4028,10 +4088,15 @@ wnck_task_expose (GtkWidget *widget,
gpointer data)
{
GtkStyle *style;
+ GdkWindow *window;
+ GtkAllocation allocation;
GdkGC *lgc, *dgc;
int x, y;
WnckTask *task;
+ window = gtk_widget_get_window (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
task = WNCK_TASK (data);
cleanup_screenshots (task);
@@ -4039,15 +4104,15 @@ wnck_task_expose (GtkWidget *widget,
switch (task->type)
{
case WNCK_TASK_CLASS_GROUP:
- style = widget->style;
+ style = gtk_widget_get_style (widget);
lgc = style->light_gc[GTK_STATE_NORMAL];
dgc = style->dark_gc[GTK_STATE_NORMAL];
- x = widget->allocation.x + widget->allocation.width -
- (GTK_CONTAINER (widget)->border_width + style->ythickness + 12);
- y = widget->allocation.y + widget->allocation.height / 2 - 5;
+ x = allocation.x + allocation.width -
+ (gtk_container_get_border_width (GTK_CONTAINER (widget)) + style->ythickness + 12);
+ y = allocation.y + allocation.height / 2 - 5;
- gtk_paint_tab (widget->style, widget->window,
+ gtk_paint_tab (style, window,
task->tasklist->priv->active_class_group == task ?
GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
GTK_SHADOW_NONE, NULL, widget, NULL, x, y, 10, 10);
@@ -4055,10 +4120,10 @@ wnck_task_expose (GtkWidget *widget,
/* Fall through to get screenshot
*/
case WNCK_TASK_WINDOW:
- if ((event->area.x <= widget->allocation.x) &&
- (event->area.y <= widget->allocation.y) &&
- (event->area.width >= widget->allocation.width) &&
- (event->area.height >= widget->allocation.height))
+ if ((event->area.x <= allocation.x) &&
+ (event->area.y <= allocation.y) &&
+ (event->area.width >= allocation.width) &&
+ (event->area.height >= allocation.height))
{
if (task->start_needs_attention)
{
diff --git a/libwnck/util.c b/libwnck/util.c
index cbfb9ea..db38c77 100644
--- a/libwnck/util.c
+++ b/libwnck/util.c
@@ -69,7 +69,7 @@ wnck_gtk_window_set_dock_type (GtkWindow *window)
{
g_return_if_fail (GTK_IS_WINDOW (window));
- gdk_window_set_type_hint (GTK_WIDGET (window)->window,
+ gdk_window_set_type_hint (gtk_widget_get_window (GTK_WIDGET (window)),
GDK_WINDOW_TYPE_HINT_DOCK);
}
diff --git a/libwnck/window-action-menu.c b/libwnck/window-action-menu.c
index 6554f12..e687cff 100644
--- a/libwnck/window-action-menu.c
+++ b/libwnck/window-action-menu.c
@@ -140,7 +140,7 @@ get_action_menu (GtkWidget *widget)
{
while (widget) {
if (GTK_IS_MENU_ITEM (widget))
- widget = widget->parent;
+ widget = gtk_widget_get_parent (widget);
if (WNCK_IS_ACTION_MENU (widget))
return WNCK_ACTION_MENU (widget);
@@ -356,9 +356,11 @@ static void
set_item_text (GtkWidget *mi,
const char *text)
{
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child),
- text);
- gtk_label_set_use_underline (GTK_LABEL (GTK_BIN (mi)->child), TRUE);
+ GtkLabel *label;
+
+ label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (mi)));
+ gtk_label_set_text (label, text);
+ gtk_label_set_use_underline (label, TRUE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]