Use accessor functions instead direct access.
GTK+ 2.20 is now the required version Still missing: GTK_MENU_SHELL ()->have_xgrab https://bugzilla.gnome.org/show_bug.cgi?id=595496
This commit is contained in:
parent
092cc47afc
commit
9e123695d0
@ -124,7 +124,7 @@ if test "x$GCC" = "xyes"; then
|
|||||||
fi
|
fi
|
||||||
changequote([,])dnl
|
changequote([,])dnl
|
||||||
|
|
||||||
MUTTER_PC_MODULES='gtk+-2.0 >= 2.10.0 pango >= 1.2.0'
|
MUTTER_PC_MODULES='gtk+-2.0 >= 2.20 pango >= 1.2.0'
|
||||||
|
|
||||||
AC_ARG_ENABLE(gconf,
|
AC_ARG_ENABLE(gconf,
|
||||||
AC_HELP_STRING([--disable-gconf],
|
AC_HELP_STRING([--disable-gconf],
|
||||||
@ -184,8 +184,8 @@ AM_GLIB_GNU_GETTEXT
|
|||||||
# GRegex requires Glib-2.14.0
|
# GRegex requires Glib-2.14.0
|
||||||
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.14.0)
|
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.14.0)
|
||||||
# gtk_window_set_icon_name requires gtk2+-2.6.0
|
# gtk_window_set_icon_name requires gtk2+-2.6.0
|
||||||
PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-2.0 >= 2.6.0)
|
PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-2.0 >= 2.20)
|
||||||
PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-2.0 >= 2.6.0)
|
PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-2.0 >= 2.20)
|
||||||
|
|
||||||
# Unconditionally use this dir to avoid a circular dep with gnomecc
|
# Unconditionally use this dir to avoid a circular dep with gnomecc
|
||||||
GNOME_KEYBINDINGS_KEYSDIR="${datadir}/gnome-control-center/keybindings"
|
GNOME_KEYBINDINGS_KEYSDIR="${datadir}/gnome-control-center/keybindings"
|
||||||
|
@ -76,14 +76,17 @@ get_pixbuf (void)
|
|||||||
static gboolean
|
static gboolean
|
||||||
regrab_idle (GtkWidget *image)
|
regrab_idle (GtkWidget *image)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GdkPixbuf *magnified;
|
GdkPixbuf *magnified;
|
||||||
|
|
||||||
if (image->allocation.width != last_grab_allocation.width ||
|
gtk_widget_get_allocation (image, &allocation);
|
||||||
image->allocation.height != last_grab_allocation.height)
|
|
||||||
|
if (allocation.width != last_grab_allocation.width ||
|
||||||
|
allocation.height != last_grab_allocation.height)
|
||||||
{
|
{
|
||||||
last_grab_width = rint (image->allocation.width / width_factor);
|
last_grab_width = rint (allocation.width / width_factor);
|
||||||
last_grab_height = rint (image->allocation.height / height_factor);
|
last_grab_height = rint (allocation.height / height_factor);
|
||||||
last_grab_allocation = image->allocation;
|
last_grab_allocation = allocation;
|
||||||
|
|
||||||
magnified = get_pixbuf ();
|
magnified = get_pixbuf ();
|
||||||
|
|
||||||
@ -224,6 +227,8 @@ mouse_press (GtkWidget *invisible,
|
|||||||
static void
|
static void
|
||||||
begin_area_grab (void)
|
begin_area_grab (void)
|
||||||
{
|
{
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
if (grab_widget == NULL)
|
if (grab_widget == NULL)
|
||||||
{
|
{
|
||||||
grab_widget = gtk_invisible_new ();
|
grab_widget = gtk_invisible_new ();
|
||||||
@ -234,7 +239,9 @@ begin_area_grab (void)
|
|||||||
gtk_widget_show (grab_widget);
|
gtk_widget_show (grab_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_keyboard_grab (grab_widget->window,
|
window = gtk_widget_get_window (grab_widget);
|
||||||
|
|
||||||
|
if (gdk_keyboard_grab (window,
|
||||||
FALSE,
|
FALSE,
|
||||||
gtk_get_current_event_time ()) != GDK_GRAB_SUCCESS)
|
gtk_get_current_event_time ()) != GDK_GRAB_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -242,7 +249,7 @@ begin_area_grab (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_pointer_grab (grab_widget->window,
|
if (gdk_pointer_grab (window,
|
||||||
FALSE,
|
FALSE,
|
||||||
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK,
|
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -62,19 +62,22 @@ static void
|
|||||||
on_realize_set_struts (GtkWindow *window,
|
on_realize_set_struts (GtkWindow *window,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
int top;
|
int top;
|
||||||
int bottom;
|
int bottom;
|
||||||
|
|
||||||
g_return_if_fail (GTK_WIDGET_REALIZED (window));
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
|
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||||
|
|
||||||
left = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-left"));
|
left = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-left"));
|
||||||
right = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-right"));
|
right = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-right"));
|
||||||
top = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-top"));
|
top = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-top"));
|
||||||
bottom = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-bottom"));
|
bottom = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-bottom"));
|
||||||
|
|
||||||
set_gdk_window_struts (GTK_WIDGET (window)->window,
|
set_gdk_window_struts (gtk_widget_get_window (widget),
|
||||||
left, right, top, bottom);
|
left, right, top, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +88,10 @@ set_gtk_window_struts (GtkWidget *window,
|
|||||||
int top,
|
int top,
|
||||||
int bottom)
|
int bottom)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (window), "meta-strut-left",
|
g_object_set_data (G_OBJECT (window), "meta-strut-left",
|
||||||
GINT_TO_POINTER (left));
|
GINT_TO_POINTER (left));
|
||||||
g_object_set_data (G_OBJECT (window), "meta-strut-right",
|
g_object_set_data (G_OBJECT (window), "meta-strut-right",
|
||||||
@ -103,8 +110,8 @@ set_gtk_window_struts (GtkWidget *window,
|
|||||||
G_CALLBACK (on_realize_set_struts),
|
G_CALLBACK (on_realize_set_struts),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (window))
|
if (gtk_widget_get_realized (widget))
|
||||||
set_gdk_window_struts (GTK_WIDGET (window)->window,
|
set_gdk_window_struts (gtk_widget_get_window (widget),
|
||||||
left, right, top, bottom);
|
left, right, top, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,15 +136,18 @@ static void
|
|||||||
on_realize_set_type (GtkWindow *window,
|
on_realize_set_type (GtkWindow *window,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
g_return_if_fail (GTK_WIDGET_REALIZED (window));
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
|
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||||
|
|
||||||
type = g_object_get_data (G_OBJECT (window), "meta-window-type");
|
type = g_object_get_data (G_OBJECT (window), "meta-window-type");
|
||||||
|
|
||||||
g_return_if_fail (type != NULL);
|
g_return_if_fail (type != NULL);
|
||||||
|
|
||||||
set_gdk_window_type (GTK_WIDGET (window)->window,
|
set_gdk_window_type (gtk_widget_get_window (widget),
|
||||||
type);
|
type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +155,10 @@ static void
|
|||||||
set_gtk_window_type (GtkWindow *window,
|
set_gtk_window_type (GtkWindow *window,
|
||||||
const char *type)
|
const char *type)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (window), "meta-window-type", (char*) type);
|
g_object_set_data (G_OBJECT (window), "meta-window-type", (char*) type);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
|
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
|
||||||
@ -156,8 +170,8 @@ set_gtk_window_type (GtkWindow *window,
|
|||||||
G_CALLBACK (on_realize_set_type),
|
G_CALLBACK (on_realize_set_type),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (window))
|
if (gtk_widget_get_realized (widget))
|
||||||
set_gdk_window_type (GTK_WIDGET (window)->window,
|
set_gdk_window_type (gtk_widget_get_window (widget),
|
||||||
type);
|
type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,14 +185,22 @@ static void
|
|||||||
on_realize_set_border_only (GtkWindow *window,
|
on_realize_set_border_only (GtkWindow *window,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_WIDGET_REALIZED (window));
|
GtkWidget *widget;
|
||||||
|
|
||||||
set_gdk_window_border_only (GTK_WIDGET (window)->window);
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
|
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||||
|
|
||||||
|
set_gdk_window_border_only (gtk_widget_get_window (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gtk_window_border_only (GtkWindow *window)
|
set_gtk_window_border_only (GtkWindow *window)
|
||||||
{
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (window);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
|
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
|
||||||
on_realize_set_border_only,
|
on_realize_set_border_only,
|
||||||
NULL);
|
NULL);
|
||||||
@ -188,8 +210,8 @@ set_gtk_window_border_only (GtkWindow *window)
|
|||||||
G_CALLBACK (on_realize_set_border_only),
|
G_CALLBACK (on_realize_set_border_only),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (window))
|
if (gtk_widget_get_realized (widget))
|
||||||
set_gdk_window_border_only (GTK_WIDGET (window)->window);
|
set_gdk_window_border_only (gtk_widget_get_window (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -77,6 +77,7 @@ draw_window (GtkWidget *widget,
|
|||||||
int icon_x, icon_y, icon_w, icon_h;
|
int icon_x, icon_y, icon_w, icon_h;
|
||||||
gboolean is_active;
|
gboolean is_active;
|
||||||
GdkColor *color;
|
GdkColor *color;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
is_active = win->is_active;
|
is_active = win->is_active;
|
||||||
|
|
||||||
@ -84,10 +85,11 @@ draw_window (GtkWidget *widget,
|
|||||||
cairo_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height);
|
cairo_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
if (is_active)
|
if (is_active)
|
||||||
color = &widget->style->light[state];
|
color = &style->light[state];
|
||||||
else
|
else
|
||||||
color = &widget->style->bg[state];
|
color = &style->bg[state];
|
||||||
cairo_set_source_rgb (cr,
|
cairo_set_source_rgb (cr,
|
||||||
color->red / 65535.,
|
color->red / 65535.,
|
||||||
color->green / 65535.,
|
color->green / 65535.,
|
||||||
@ -143,9 +145,9 @@ draw_window (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_active)
|
if (is_active)
|
||||||
color = &widget->style->fg[state];
|
color = &style->fg[state];
|
||||||
else
|
else
|
||||||
color = &widget->style->fg[state];
|
color = &style->fg[state];
|
||||||
|
|
||||||
cairo_set_source_rgb (cr,
|
cairo_set_source_rgb (cr,
|
||||||
color->red / 65535.,
|
color->red / 65535.,
|
||||||
@ -177,6 +179,7 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
int i;
|
int i;
|
||||||
GdkRectangle workspace_rect;
|
GdkRectangle workspace_rect;
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
workspace_rect.x = x;
|
workspace_rect.x = x;
|
||||||
workspace_rect.y = y;
|
workspace_rect.y = y;
|
||||||
@ -190,10 +193,12 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
if (workspace_background)
|
if (workspace_background)
|
||||||
{
|
{
|
||||||
gdk_draw_pixbuf (drawable,
|
gdk_draw_pixbuf (drawable,
|
||||||
GTK_WIDGET (widget)->style->dark_gc[state],
|
style->dark_gc[state],
|
||||||
workspace_background,
|
workspace_background,
|
||||||
0, 0,
|
0, 0,
|
||||||
x, y,
|
x, y,
|
||||||
@ -205,8 +210,8 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
cr = gdk_cairo_create (widget->window);
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
gdk_cairo_set_source_color (cr, &widget->style->dark[state]);
|
gdk_cairo_set_source_color (cr, &style->dark[state]);
|
||||||
cairo_rectangle (cr, x, y, width, height);
|
cairo_rectangle (cr, x, y, width, height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
@ -53,7 +53,8 @@ static int screen_bottom_edge = 0;
|
|||||||
static gint
|
static gint
|
||||||
expose_handler (GtkTooltips *tooltips)
|
expose_handler (GtkTooltips *tooltips)
|
||||||
{
|
{
|
||||||
gtk_paint_flat_box (tip->style, tip->window,
|
gtk_paint_flat_box (gtk_widget_get_style (tip),
|
||||||
|
gtk_widget_get_window (tip),
|
||||||
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
||||||
NULL, tip, "tooltip",
|
NULL, tip, "tooltip",
|
||||||
0, 0, -1, -1);
|
0, 0, -1, -1);
|
||||||
|
@ -133,6 +133,24 @@ meta_frames_get_type (void)
|
|||||||
return frames_type;
|
return frames_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GObject *
|
||||||
|
meta_frames_constructor (GType gtype,
|
||||||
|
guint n_properties,
|
||||||
|
GObjectConstructParam *properties)
|
||||||
|
{
|
||||||
|
GObject *object;
|
||||||
|
GObjectClass *gobject_class;
|
||||||
|
|
||||||
|
gobject_class = G_OBJECT_CLASS (parent_class);
|
||||||
|
object = gobject_class->constructor (gtype, n_properties, properties);
|
||||||
|
|
||||||
|
g_object_set (object,
|
||||||
|
"type", GTK_WINDOW_POPUP,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_frames_class_init (MetaFramesClass *class)
|
meta_frames_class_init (MetaFramesClass *class)
|
||||||
{
|
{
|
||||||
@ -146,6 +164,7 @@ meta_frames_class_init (MetaFramesClass *class)
|
|||||||
|
|
||||||
parent_class = g_type_class_peek_parent (class);
|
parent_class = g_type_class_peek_parent (class);
|
||||||
|
|
||||||
|
gobject_class->constructor = meta_frames_constructor;
|
||||||
gobject_class->finalize = meta_frames_finalize;
|
gobject_class->finalize = meta_frames_finalize;
|
||||||
object_class->destroy = meta_frames_destroy;
|
object_class->destroy = meta_frames_destroy;
|
||||||
|
|
||||||
@ -203,8 +222,6 @@ prefs_changed_callback (MetaPreference pref,
|
|||||||
static void
|
static void
|
||||||
meta_frames_init (MetaFrames *frames)
|
meta_frames_init (MetaFrames *frames)
|
||||||
{
|
{
|
||||||
GTK_WINDOW (frames)->type = GTK_WINDOW_POPUP;
|
|
||||||
|
|
||||||
frames->text_heights = g_hash_table_new (NULL, NULL);
|
frames->text_heights = g_hash_table_new (NULL, NULL);
|
||||||
|
|
||||||
frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal);
|
frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal);
|
||||||
@ -460,10 +477,10 @@ meta_frames_ensure_layout (MetaFrames *frames,
|
|||||||
MetaFrameType type;
|
MetaFrameType type;
|
||||||
MetaFrameStyle *style;
|
MetaFrameStyle *style;
|
||||||
|
|
||||||
g_return_if_fail (GTK_WIDGET_REALIZED (frames));
|
|
||||||
|
|
||||||
widget = GTK_WIDGET (frames);
|
widget = GTK_WIDGET (frames);
|
||||||
|
|
||||||
|
g_return_if_fail (gtk_widget_get_realized (widget));
|
||||||
|
|
||||||
meta_core_get (gdk_display, frame->xwindow,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
META_CORE_GET_FRAME_FLAGS, &flags,
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
META_CORE_GET_FRAME_TYPE, &type,
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
|
@ -386,6 +386,7 @@ meta_window_menu_new (MetaFrames *frames,
|
|||||||
Display *display;
|
Display *display;
|
||||||
Window xroot;
|
Window xroot;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
GdkWindow *window;
|
||||||
GtkWidget *submenu;
|
GtkWidget *submenu;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
@ -398,9 +399,10 @@ meta_window_menu_new (MetaFrames *frames,
|
|||||||
meta_verbose ("Creating %d-workspace menu current space %lu\n",
|
meta_verbose ("Creating %d-workspace menu current space %lu\n",
|
||||||
n_workspaces, active_workspace);
|
n_workspaces, active_workspace);
|
||||||
|
|
||||||
display = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window);
|
window = gtk_widget_get_window (GTK_WIDGET (frames));
|
||||||
|
display = gdk_x11_drawable_get_xdisplay (window);
|
||||||
|
|
||||||
screen = gdk_drawable_get_screen (GTK_WIDGET (frames)->window);
|
screen = gdk_drawable_get_screen (window);
|
||||||
xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen));
|
xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen));
|
||||||
|
|
||||||
submenu = gtk_menu_new ();
|
submenu = gtk_menu_new ();
|
||||||
|
@ -262,52 +262,61 @@ meta_accel_label_expose_event (GtkWidget *widget,
|
|||||||
GtkMisc *misc = GTK_MISC (accel_label);
|
GtkMisc *misc = GTK_MISC (accel_label);
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (accel_label))
|
if (gtk_widget_is_drawable (GTK_WIDGET (accel_label)))
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GtkRequisition requisition;
|
||||||
int ac_width;
|
int ac_width;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
gtk_widget_get_requisition (widget, &requisition);
|
||||||
ac_width = meta_accel_label_get_accel_width (accel_label);
|
ac_width = meta_accel_label_get_accel_width (accel_label);
|
||||||
|
|
||||||
if (widget->allocation.width >= widget->requisition.width + ac_width)
|
if (allocation.width >= requisition.width + ac_width)
|
||||||
{
|
{
|
||||||
GtkTextDirection direction = gtk_widget_get_direction (widget);
|
GtkTextDirection direction = gtk_widget_get_direction (widget);
|
||||||
gint x;
|
gfloat xalign, yalign;
|
||||||
gint y;
|
gint x, y;
|
||||||
|
gint xpad, ypad;
|
||||||
|
|
||||||
|
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||||
|
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
widget->allocation.x += ac_width;
|
allocation.x += ac_width;
|
||||||
}
|
}
|
||||||
widget->allocation.width -= ac_width;
|
allocation.width -= ac_width;
|
||||||
|
gtk_widget_set_allocation (widget, &allocation);
|
||||||
|
|
||||||
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
|
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
|
||||||
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
|
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
widget->allocation.x -= ac_width;
|
allocation.x -= ac_width;
|
||||||
}
|
}
|
||||||
widget->allocation.width += ac_width;
|
allocation.width += ac_width;
|
||||||
|
gtk_widget_set_allocation (widget, &allocation);
|
||||||
|
|
||||||
if (direction == GTK_TEXT_DIR_RTL)
|
if (direction == GTK_TEXT_DIR_RTL)
|
||||||
{
|
{
|
||||||
x = widget->allocation.x + misc->xpad;
|
x = allocation.x + xpad;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = widget->allocation.x + widget->allocation.width - misc->xpad - ac_width;
|
x = allocation.x + allocation.width - xpad - ac_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = (widget->allocation.y * (1.0 - misc->yalign) +
|
y = (allocation.y * (1.0 - yalign) +
|
||||||
(widget->allocation.y + widget->allocation.height -
|
(allocation.y + allocation.height -
|
||||||
(widget->requisition.height - misc->ypad * 2)) *
|
(requisition.height - ypad * 2)) * yalign) + 1.5;
|
||||||
misc->yalign) + 1.5;
|
|
||||||
|
|
||||||
layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
|
layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
|
||||||
|
|
||||||
gtk_paint_layout (widget->style,
|
gtk_paint_layout (gtk_widget_get_style (widget),
|
||||||
widget->window,
|
gtk_widget_get_window (widget),
|
||||||
GTK_WIDGET_STATE (widget),
|
gtk_widget_get_state (widget),
|
||||||
FALSE,
|
FALSE,
|
||||||
&event->area,
|
&event->area,
|
||||||
widget,
|
widget,
|
||||||
|
@ -86,7 +86,7 @@ meta_preview_init (MetaPreview *preview)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GTK_WIDGET_SET_FLAGS (preview, GTK_NO_WINDOW);
|
gtk_widget_set_has_window (GTK_WIDGET (preview), FALSE);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < MAX_BUTTONS_PER_CORNER)
|
while (i < MAX_BUTTONS_PER_CORNER)
|
||||||
@ -216,6 +216,7 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
MetaPreview *preview;
|
MetaPreview *preview;
|
||||||
|
GtkAllocation allocation;
|
||||||
int border_width;
|
int border_width;
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
@ -234,10 +235,11 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
ensure_info (preview);
|
ensure_info (preview);
|
||||||
|
|
||||||
border_width = GTK_CONTAINER (widget)->border_width;
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
|
||||||
client_width = widget->allocation.width - preview->left_width - preview->right_width - border_width * 2;
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
client_height = widget->allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
|
client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
|
||||||
|
client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
|
||||||
|
|
||||||
if (client_width < 0)
|
if (client_width < 0)
|
||||||
client_width = 1;
|
client_width = 1;
|
||||||
@ -246,14 +248,12 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
if (preview->theme)
|
if (preview->theme)
|
||||||
{
|
{
|
||||||
border_width = GTK_CONTAINER (widget)->border_width;
|
|
||||||
|
|
||||||
meta_theme_draw_frame (preview->theme,
|
meta_theme_draw_frame (preview->theme,
|
||||||
widget,
|
widget,
|
||||||
widget->window,
|
gtk_widget_get_window (widget),
|
||||||
&event->area,
|
&event->area,
|
||||||
widget->allocation.x + border_width,
|
allocation.x + border_width,
|
||||||
widget->allocation.y + border_width,
|
allocation.y + border_width,
|
||||||
preview->type,
|
preview->type,
|
||||||
preview->flags,
|
preview->flags,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
@ -274,6 +274,8 @@ meta_preview_size_request (GtkWidget *widget,
|
|||||||
GtkRequisition *req)
|
GtkRequisition *req)
|
||||||
{
|
{
|
||||||
MetaPreview *preview;
|
MetaPreview *preview;
|
||||||
|
GtkWidget *child;
|
||||||
|
guint border_width;
|
||||||
|
|
||||||
preview = META_PREVIEW (widget);
|
preview = META_PREVIEW (widget);
|
||||||
|
|
||||||
@ -282,12 +284,12 @@ meta_preview_size_request (GtkWidget *widget,
|
|||||||
req->width = preview->left_width + preview->right_width;
|
req->width = preview->left_width + preview->right_width;
|
||||||
req->height = preview->top_height + preview->bottom_height;
|
req->height = preview->top_height + preview->bottom_height;
|
||||||
|
|
||||||
if (GTK_BIN (preview)->child &&
|
child = gtk_bin_get_child (GTK_BIN (preview));
|
||||||
GTK_WIDGET_VISIBLE (GTK_BIN (preview)->child))
|
if (child && gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
GtkRequisition child_requisition;
|
GtkRequisition child_requisition;
|
||||||
|
|
||||||
gtk_widget_size_request (GTK_BIN (preview)->child, &child_requisition);
|
gtk_widget_size_request (child, &child_requisition);
|
||||||
|
|
||||||
req->width += child_requisition.width;
|
req->width += child_requisition.width;
|
||||||
req->height += child_requisition.height;
|
req->height += child_requisition.height;
|
||||||
@ -300,8 +302,9 @@ meta_preview_size_request (GtkWidget *widget,
|
|||||||
req->height += NO_CHILD_HEIGHT;
|
req->height += NO_CHILD_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->width += GTK_CONTAINER (widget)->border_width * 2;
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
req->height += GTK_CONTAINER (widget)->border_width * 2;
|
req->width += border_width * 2;
|
||||||
|
req->height += border_width * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -309,27 +312,29 @@ meta_preview_size_allocate (GtkWidget *widget,
|
|||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
MetaPreview *preview;
|
MetaPreview *preview;
|
||||||
int border_width;
|
GtkAllocation widget_allocation, child_allocation;
|
||||||
GtkAllocation child_allocation;
|
GtkWidget *child;
|
||||||
|
guint border_width;
|
||||||
|
|
||||||
preview = META_PREVIEW (widget);
|
preview = META_PREVIEW (widget);
|
||||||
|
|
||||||
ensure_info (preview);
|
ensure_info (preview);
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
gtk_widget_set_allocation (widget, allocation);
|
||||||
|
|
||||||
border_width = GTK_CONTAINER (widget)->border_width;
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
|
||||||
if (GTK_BIN (widget)->child &&
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
GTK_WIDGET_VISIBLE (GTK_BIN (widget)->child))
|
if (child && gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
child_allocation.x = widget->allocation.x + border_width + preview->left_width;
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
child_allocation.y = widget->allocation.y + border_width + preview->top_height;
|
child_allocation.x = widget_allocation.x + border_width + preview->left_width;
|
||||||
|
child_allocation.y = widget_allocation.y + border_width + preview->top_height;
|
||||||
|
|
||||||
child_allocation.width = MAX (1, widget->allocation.width - border_width * 2 - preview->left_width - preview->right_width);
|
child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width);
|
||||||
child_allocation.height = MAX (1, widget->allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
|
child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
|
||||||
|
|
||||||
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child_allocation);
|
gtk_widget_size_allocate (child, &child_allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +123,10 @@ update_size_window (MetaResizePopup *popup)
|
|||||||
x = popup->rect.x + (popup->rect.width - width) / 2;
|
x = popup->rect.x + (popup->rect.width - width) / 2;
|
||||||
y = popup->rect.y + (popup->rect.height - height) / 2;
|
y = popup->rect.y + (popup->rect.height - height) / 2;
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (popup->size_window))
|
if (gtk_widget_get_realized (popup->size_window))
|
||||||
{
|
{
|
||||||
/* using move_resize to avoid jumpiness */
|
/* using move_resize to avoid jumpiness */
|
||||||
gdk_window_move_resize (popup->size_window->window,
|
gdk_window_move_resize (gtk_widget_get_window (popup->size_window),
|
||||||
x, y,
|
x, y,
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
@ -145,8 +145,8 @@ sync_showing (MetaResizePopup *popup)
|
|||||||
if (popup->size_window)
|
if (popup->size_window)
|
||||||
gtk_widget_show (popup->size_window);
|
gtk_widget_show (popup->size_window);
|
||||||
|
|
||||||
if (popup->size_window && GTK_WIDGET_REALIZED (popup->size_window))
|
if (popup->size_window && gtk_widget_get_realized (popup->size_window))
|
||||||
gdk_window_raise (popup->size_window->window);
|
gdk_window_raise (gtk_widget_get_window (popup->size_window));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,8 @@ outline_window_expose (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
MetaTabPopup *popup;
|
MetaTabPopup *popup;
|
||||||
TabEntry *te;
|
TabEntry *te;
|
||||||
|
GtkStyle *style;
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
popup = data;
|
popup = data;
|
||||||
|
|
||||||
@ -85,16 +87,18 @@ outline_window_expose (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
te = popup->current_selected_entry;
|
te = popup->current_selected_entry;
|
||||||
|
window = gtk_widget_get_window (widget);
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (window,
|
||||||
widget->style->white_gc,
|
style->white_gc,
|
||||||
FALSE,
|
FALSE,
|
||||||
0, 0,
|
0, 0,
|
||||||
te->rect.width - 1,
|
te->rect.width - 1,
|
||||||
te->rect.height - 1);
|
te->rect.height - 1);
|
||||||
|
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (window,
|
||||||
widget->style->white_gc,
|
style->white_gc,
|
||||||
FALSE,
|
FALSE,
|
||||||
te->inner_rect.x - 1, te->inner_rect.y - 1,
|
te->inner_rect.x - 1, te->inner_rect.y - 1,
|
||||||
te->inner_rect.width + 1,
|
te->inner_rect.width + 1,
|
||||||
@ -439,7 +443,7 @@ meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GTK_WIDGET_VISIBLE (popup->window))
|
if (gtk_widget_get_visible (popup->window))
|
||||||
{
|
{
|
||||||
meta_verbose ("Hiding tab popup window\n");
|
meta_verbose ("Hiding tab popup window\n");
|
||||||
gtk_widget_hide (popup->window);
|
gtk_widget_hide (popup->window);
|
||||||
@ -455,6 +459,7 @@ display_entry (MetaTabPopup *popup,
|
|||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
GdkRegion *region;
|
GdkRegion *region;
|
||||||
GdkRegion *inner_region;
|
GdkRegion *inner_region;
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
|
|
||||||
if (popup->current_selected_entry)
|
if (popup->current_selected_entry)
|
||||||
@ -474,27 +479,29 @@ display_entry (MetaTabPopup *popup,
|
|||||||
|
|
||||||
if (popup->outline)
|
if (popup->outline)
|
||||||
{
|
{
|
||||||
|
window = gtk_widget_get_window (popup->outline_window);
|
||||||
|
|
||||||
/* Do stuff behind gtk's back */
|
/* Do stuff behind gtk's back */
|
||||||
gdk_window_hide (popup->outline_window->window);
|
gdk_window_hide (window);
|
||||||
meta_core_increment_event_serial (gdk_display);
|
meta_core_increment_event_serial (gdk_display);
|
||||||
|
|
||||||
rect = te->rect;
|
rect = te->rect;
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
|
|
||||||
gdk_window_move_resize (popup->outline_window->window,
|
gdk_window_move_resize (window,
|
||||||
te->rect.x, te->rect.y,
|
te->rect.x, te->rect.y,
|
||||||
te->rect.width, te->rect.height);
|
te->rect.width, te->rect.height);
|
||||||
|
|
||||||
gdk_window_set_background (popup->outline_window->window,
|
gdk_window_set_background (window,
|
||||||
&popup->outline_window->style->black);
|
>k_widget_get_style (popup->outline_window)->black);
|
||||||
|
|
||||||
region = gdk_region_rectangle (&rect);
|
region = gdk_region_rectangle (&rect);
|
||||||
inner_region = gdk_region_rectangle (&te->inner_rect);
|
inner_region = gdk_region_rectangle (&te->inner_rect);
|
||||||
gdk_region_subtract (region, inner_region);
|
gdk_region_subtract (region, inner_region);
|
||||||
gdk_region_destroy (inner_region);
|
gdk_region_destroy (inner_region);
|
||||||
|
|
||||||
gdk_window_shape_combine_region (popup->outline_window->window,
|
gdk_window_shape_combine_region (window,
|
||||||
region,
|
region,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
@ -505,8 +512,8 @@ display_entry (MetaTabPopup *popup,
|
|||||||
* we manually set the window as mapped and then manually map it
|
* we manually set the window as mapped and then manually map it
|
||||||
* with gdk functions.
|
* with gdk functions.
|
||||||
*/
|
*/
|
||||||
GTK_WIDGET_SET_FLAGS (popup->outline_window, GTK_MAPPED);
|
gtk_widget_set_mapped (popup->outline_window, TRUE);
|
||||||
gdk_window_show_unraised (popup->outline_window->window);
|
gdk_window_show_unraised (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be before we handle an expose for the outline window */
|
/* Must be before we handle an expose for the outline window */
|
||||||
@ -691,32 +698,46 @@ meta_select_image_expose_event (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
if (META_SELECT_IMAGE (widget)->selected)
|
if (META_SELECT_IMAGE (widget)->selected)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
GtkAllocation allocation;
|
||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
|
GtkRequisition requisition;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkStateType state;
|
||||||
|
GdkWindow *window;
|
||||||
|
int x, y, w, h;
|
||||||
|
gint xpad, ypad;
|
||||||
|
gfloat xalign, yalign;
|
||||||
|
|
||||||
misc = GTK_MISC (widget);
|
misc = GTK_MISC (widget);
|
||||||
|
|
||||||
x = (widget->allocation.x * (1.0 - misc->xalign) +
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
(widget->allocation.x + widget->allocation.width
|
gtk_widget_get_requisition (widget, &requisition);
|
||||||
- (widget->requisition.width - misc->xpad * 2)) *
|
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||||
misc->xalign) + 0.5;
|
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||||
y = (widget->allocation.y * (1.0 - misc->yalign) +
|
|
||||||
(widget->allocation.y + widget->allocation.height
|
x = (allocation.x * (1.0 - xalign) +
|
||||||
- (widget->requisition.height - misc->ypad * 2)) *
|
(allocation.x + allocation.width
|
||||||
misc->yalign) + 0.5;
|
- (requisition.width - xpad * 2)) * xalign) + 0.5;
|
||||||
|
y = (allocation.y * (1.0 - yalign) +
|
||||||
|
(allocation.y + allocation.height
|
||||||
|
- (requisition.height - ypad * 2)) * yalign) + 0.5;
|
||||||
|
|
||||||
x -= INSIDE_SELECT_RECT + 1;
|
x -= INSIDE_SELECT_RECT + 1;
|
||||||
y -= INSIDE_SELECT_RECT + 1;
|
y -= INSIDE_SELECT_RECT + 1;
|
||||||
|
|
||||||
w = widget->requisition.width - OUTSIDE_SELECT_RECT * 2 - 1;
|
w = requisition.width - OUTSIDE_SELECT_RECT * 2 - 1;
|
||||||
h = widget->requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
|
h = requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
|
||||||
|
|
||||||
gdk_draw_rectangle (widget->window,
|
window = gtk_widget_get_window (widget);
|
||||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
style = gtk_widget_get_style (widget);
|
||||||
|
state = gtk_widget_get_state (widget);
|
||||||
|
|
||||||
|
gdk_draw_rectangle (window,
|
||||||
|
style->fg_gc[state],
|
||||||
FALSE,
|
FALSE,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (window,
|
||||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
style->fg_gc[state],
|
||||||
FALSE,
|
FALSE,
|
||||||
x - 1, y - 1, w + 2, h + 2);
|
x - 1, y - 1, w + 2, h + 2);
|
||||||
|
|
||||||
@ -879,6 +900,9 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
MetaWorkspace *workspace;
|
MetaWorkspace *workspace;
|
||||||
WnckWindowDisplayInfo *windows;
|
WnckWindowDisplayInfo *windows;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GtkStyle *style;
|
||||||
|
GdkWindow *window;
|
||||||
int i, n_windows;
|
int i, n_windows;
|
||||||
GList *tmp, *list;
|
GList *tmp, *list;
|
||||||
|
|
||||||
@ -917,12 +941,15 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
|
|
||||||
g_list_free (list);
|
g_list_free (list);
|
||||||
|
|
||||||
|
window = gtk_widget_get_window (widget);
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
wnck_draw_workspace (widget,
|
wnck_draw_workspace (widget,
|
||||||
widget->window,
|
window,
|
||||||
SELECT_OUTLINE_WIDTH,
|
SELECT_OUTLINE_WIDTH,
|
||||||
SELECT_OUTLINE_WIDTH,
|
SELECT_OUTLINE_WIDTH,
|
||||||
widget->allocation.width - SELECT_OUTLINE_WIDTH * 2,
|
allocation.width - SELECT_OUTLINE_WIDTH * 2,
|
||||||
widget->allocation.height - SELECT_OUTLINE_WIDTH * 2,
|
allocation.height - SELECT_OUTLINE_WIDTH * 2,
|
||||||
workspace->screen->rect.width,
|
workspace->screen->rect.width,
|
||||||
workspace->screen->rect.height,
|
workspace->screen->rect.height,
|
||||||
NULL,
|
NULL,
|
||||||
@ -934,16 +961,18 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
|
|
||||||
if (META_SELECT_WORKSPACE (widget)->selected)
|
if (META_SELECT_WORKSPACE (widget)->selected)
|
||||||
{
|
{
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
i = SELECT_OUTLINE_WIDTH - 1;
|
i = SELECT_OUTLINE_WIDTH - 1;
|
||||||
|
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
{
|
{
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (window,
|
||||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
style->fg_gc[gtk_widget_get_state (widget)],
|
||||||
FALSE,
|
FALSE,
|
||||||
i,
|
i,
|
||||||
i,
|
i,
|
||||||
widget->allocation.width - i * 2 - 1,
|
allocation.width - i * 2 - 1,
|
||||||
widget->allocation.height - i * 2 - 1);
|
allocation.height - i * 2 - 1);
|
||||||
|
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
|
@ -267,11 +267,16 @@ expose_callback (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
RenderGradientFunc func = data;
|
RenderGradientFunc func = data;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
(* func) (widget->window,
|
style = gtk_widget_get_style (widget);
|
||||||
widget->style->fg_gc[widget->state],
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
widget->allocation.width,
|
|
||||||
widget->allocation.height);
|
(* func) (gtk_widget_get_window (widget),
|
||||||
|
style->fg_gc[gtk_widget_get_state (widget)],
|
||||||
|
allocation.width,
|
||||||
|
allocation.height);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -766,6 +766,7 @@ benchmark_summary (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
GtkStyle *style;
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *collection;
|
GtkWidget *collection;
|
||||||
GError *err;
|
GError *err;
|
||||||
@ -842,26 +843,28 @@ main (int argc, char **argv)
|
|||||||
G_CALLBACK (gtk_main_quit), NULL);
|
G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
|
||||||
gtk_widget_realize (window);
|
gtk_widget_realize (window);
|
||||||
g_assert (window->style);
|
style = gtk_widget_get_style (window);
|
||||||
g_assert (window->style->font_desc);
|
|
||||||
|
g_assert (style);
|
||||||
|
g_assert (style->font_desc);
|
||||||
|
|
||||||
notebook = gtk_notebook_new ();
|
notebook = gtk_notebook_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (window), notebook);
|
gtk_container_add (GTK_CONTAINER (window), notebook);
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_NORMAL,
|
collection = preview_collection (FONT_SIZE_NORMAL,
|
||||||
window->style->font_desc);
|
style->font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Normal Title Font")));
|
gtk_label_new (_("Normal Title Font")));
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_SMALL,
|
collection = preview_collection (FONT_SIZE_SMALL,
|
||||||
window->style->font_desc);
|
style->font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Small Title Font")));
|
gtk_label_new (_("Small Title Font")));
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_LARGE,
|
collection = preview_collection (FONT_SIZE_LARGE,
|
||||||
window->style->font_desc);
|
style->font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Large Title Font")));
|
gtk_label_new (_("Large Title Font")));
|
||||||
@ -912,7 +915,7 @@ get_flags (GtkWidget *widget)
|
|||||||
static int
|
static int
|
||||||
get_text_height (GtkWidget *widget)
|
get_text_height (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
return meta_pango_font_desc_get_text_height (widget->style->font_desc,
|
return meta_pango_font_desc_get_text_height (gtk_widget_get_style (widget)->font_desc,
|
||||||
gtk_widget_get_pango_context (widget));
|
gtk_widget_get_pango_context (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,7 +996,7 @@ run_theme_benchmark (void)
|
|||||||
/* Creating the pixmap in the loop is right, since
|
/* Creating the pixmap in the loop is right, since
|
||||||
* GDK does the same with its double buffering.
|
* GDK does the same with its double buffering.
|
||||||
*/
|
*/
|
||||||
pixmap = gdk_pixmap_new (widget->window,
|
pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
|
||||||
client_width + left_width + right_width,
|
client_width + left_width + right_width,
|
||||||
client_height + top_height + bottom_height,
|
client_height + top_height + bottom_height,
|
||||||
-1);
|
-1);
|
||||||
|
@ -1360,9 +1360,13 @@ meta_color_spec_render (MetaColorSpec *spec,
|
|||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
GdkColor *color)
|
GdkColor *color)
|
||||||
{
|
{
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
g_return_if_fail (spec != NULL);
|
g_return_if_fail (spec != NULL);
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (widget->style != NULL);
|
g_return_if_fail (style != NULL);
|
||||||
|
|
||||||
switch (spec->type)
|
switch (spec->type)
|
||||||
{
|
{
|
||||||
@ -1374,28 +1378,28 @@ meta_color_spec_render (MetaColorSpec *spec,
|
|||||||
switch (spec->data.gtk.component)
|
switch (spec->data.gtk.component)
|
||||||
{
|
{
|
||||||
case META_GTK_COLOR_BG:
|
case META_GTK_COLOR_BG:
|
||||||
*color = widget->style->bg[spec->data.gtk.state];
|
*color = style->bg[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_FG:
|
case META_GTK_COLOR_FG:
|
||||||
*color = widget->style->fg[spec->data.gtk.state];
|
*color = style->fg[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_BASE:
|
case META_GTK_COLOR_BASE:
|
||||||
*color = widget->style->base[spec->data.gtk.state];
|
*color = style->base[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_TEXT:
|
case META_GTK_COLOR_TEXT:
|
||||||
*color = widget->style->text[spec->data.gtk.state];
|
*color = style->text[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_LIGHT:
|
case META_GTK_COLOR_LIGHT:
|
||||||
*color = widget->style->light[spec->data.gtk.state];
|
*color = style->light[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_DARK:
|
case META_GTK_COLOR_DARK:
|
||||||
*color = widget->style->dark[spec->data.gtk.state];
|
*color = style->dark[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_MID:
|
case META_GTK_COLOR_MID:
|
||||||
*color = widget->style->mid[spec->data.gtk.state];
|
*color = style->mid[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_TEXT_AA:
|
case META_GTK_COLOR_TEXT_AA:
|
||||||
*color = widget->style->text_aa[spec->data.gtk.state];
|
*color = style->text_aa[spec->data.gtk.state];
|
||||||
break;
|
break;
|
||||||
case META_GTK_COLOR_LAST:
|
case META_GTK_COLOR_LAST:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -3907,7 +3911,7 @@ meta_draw_op_draw (const MetaDrawOp *op,
|
|||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
MetaRectangle logical_region)
|
MetaRectangle logical_region)
|
||||||
{
|
{
|
||||||
meta_draw_op_draw_with_style (op, widget->style, widget,
|
meta_draw_op_draw_with_style (op, gtk_widget_get_style (widget), widget,
|
||||||
drawable, clip, info, logical_region);
|
drawable, clip, info, logical_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4037,7 +4041,7 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
MetaRectangle rect)
|
MetaRectangle rect)
|
||||||
|
|
||||||
{
|
{
|
||||||
meta_draw_op_list_draw_with_style (op_list, widget->style, widget,
|
meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style (widget), widget,
|
||||||
drawable, clip, info, rect);
|
drawable, clip, info, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4609,7 +4613,7 @@ meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
meta_frame_style_draw_with_style (style, widget->style, widget,
|
meta_frame_style_draw_with_style (style, gtk_widget_get_style (widget), widget,
|
||||||
drawable, x_offset, y_offset,
|
drawable, x_offset, y_offset,
|
||||||
clip, fgeom, client_width, client_height,
|
clip, fgeom, client_width, client_height,
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
@ -5234,7 +5238,7 @@ meta_theme_draw_frame (MetaTheme *theme,
|
|||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
meta_theme_draw_frame_with_style (theme, widget->style, widget,
|
meta_theme_draw_frame_with_style (theme, gtk_widget_get_style (widget), widget,
|
||||||
drawable, clip, x_offset, y_offset, type,flags,
|
drawable, clip, x_offset, y_offset, type,flags,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
@ -5628,9 +5632,9 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
|
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
|
||||||
|
|
||||||
font_desc = pango_font_description_copy (widget->style->font_desc);
|
font_desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
|
||||||
|
|
||||||
if (override)
|
if (override)
|
||||||
pango_font_description_merge (font_desc, override, TRUE);
|
pango_font_description_merge (font_desc, override, TRUE);
|
||||||
|
@ -80,7 +80,7 @@ meta_area_class_init (MetaAreaClass *class)
|
|||||||
static void
|
static void
|
||||||
meta_area_init (MetaArea *area)
|
meta_area_init (MetaArea *area)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_SET_FLAGS (area, GTK_NO_WINDOW);
|
gtk_widget_set_has_window (GTK_WIDGET (area), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
@ -111,28 +111,34 @@ meta_area_expose (GtkWidget *widget,
|
|||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
MetaArea *area;
|
MetaArea *area;
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
|
GtkRequisition requisition;
|
||||||
|
gfloat xalign, yalign;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gfloat xalign;
|
gint xpad, ypad;
|
||||||
|
|
||||||
g_return_val_if_fail (META_IS_AREA (widget), FALSE);
|
g_return_val_if_fail (META_IS_AREA (widget), FALSE);
|
||||||
g_return_val_if_fail (event != NULL, FALSE);
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
if (GTK_WIDGET_DRAWABLE (widget))
|
if (gtk_widget_is_drawable (widget))
|
||||||
{
|
{
|
||||||
area = META_AREA (widget);
|
area = META_AREA (widget);
|
||||||
misc = GTK_MISC (widget);
|
misc = GTK_MISC (widget);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
xalign = misc->xalign;
|
gtk_widget_get_requisition (widget, &requisition);
|
||||||
else
|
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||||
xalign = 1.0 - misc->xalign;
|
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||||
|
|
||||||
x = floor (widget->allocation.x + misc->xpad
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||||
+ ((widget->allocation.width - widget->requisition.width) * xalign)
|
xalign = 1.0 - xalign;
|
||||||
|
|
||||||
|
x = floor (allocation.x + xpad
|
||||||
|
+ ((allocation.width - requisition.width) * xalign)
|
||||||
+ 0.5);
|
+ 0.5);
|
||||||
y = floor (widget->allocation.y + misc->ypad
|
y = floor (allocation.y + ypad
|
||||||
+ ((widget->allocation.height - widget->requisition.height) * misc->yalign)
|
+ ((allocation.height - requisition.height) * yalign)
|
||||||
+ 0.5);
|
+ 0.5);
|
||||||
|
|
||||||
if (area->expose_func)
|
if (area->expose_func)
|
||||||
|
14
src/ui/ui.c
14
src/ui/ui.c
@ -379,7 +379,7 @@ meta_image_window_new (Display *xdisplay,
|
|||||||
gtk_window_set_screen (GTK_WINDOW (iw->window), gscreen);
|
gtk_window_set_screen (GTK_WINDOW (iw->window), gscreen);
|
||||||
|
|
||||||
gtk_widget_realize (iw->window);
|
gtk_widget_realize (iw->window);
|
||||||
iw->pixmap = gdk_pixmap_new (iw->window->window,
|
iw->pixmap = gdk_pixmap_new (gtk_widget_get_window (iw->window),
|
||||||
max_width, max_height,
|
max_width, max_height,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
@ -417,13 +417,15 @@ meta_image_window_set (MetaImageWindow *iw,
|
|||||||
int x,
|
int x,
|
||||||
int y)
|
int y)
|
||||||
{
|
{
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
/* We use a back pixmap to avoid having to handle exposes, because
|
/* We use a back pixmap to avoid having to handle exposes, because
|
||||||
* it's really too slow for large clients being minimized, etc.
|
* it's really too slow for large clients being minimized, etc.
|
||||||
* and this way flicker is genuinely zero.
|
* and this way flicker is genuinely zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gdk_draw_pixbuf (iw->pixmap,
|
gdk_draw_pixbuf (iw->pixmap,
|
||||||
iw->window->style->black_gc,
|
gtk_widget_get_style (iw->window)->black_gc,
|
||||||
pixbuf,
|
pixbuf,
|
||||||
0, 0,
|
0, 0,
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -432,16 +434,18 @@ meta_image_window_set (MetaImageWindow *iw,
|
|||||||
GDK_RGB_DITHER_NORMAL,
|
GDK_RGB_DITHER_NORMAL,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
gdk_window_set_back_pixmap (iw->window->window,
|
window = gtk_widget_get_window (iw->window);
|
||||||
|
|
||||||
|
gdk_window_set_back_pixmap (window,
|
||||||
iw->pixmap,
|
iw->pixmap,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
gdk_window_move_resize (iw->window->window,
|
gdk_window_move_resize (window,
|
||||||
x, y,
|
x, y,
|
||||||
gdk_pixbuf_get_width (pixbuf),
|
gdk_pixbuf_get_width (pixbuf),
|
||||||
gdk_pixbuf_get_height (pixbuf));
|
gdk_pixbuf_get_height (pixbuf));
|
||||||
|
|
||||||
gdk_window_clear (iw->window->window);
|
gdk_window_clear (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkColormap*
|
static GdkColormap*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user