Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-01-20 19:53:58 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-01-20 19:53:58 (GMT)
commit2af881bd90a35b4f1343b027ba7c3c0464930fb1 (patch)
tree0cb42d141d39ed98dc2c0cd16e20d06c19fa4f3d /shell
parentf49b3e4caf852fae2c8ab3a210412b81b4ae1ff2 (diff)
Use normal style color for the widget background and draw a black box
2005-01-20 Marco Pesenti Gritti <marco@gnome.org> * shell/ev-view.c: (ev_view_size_request), (ev_view_realize), (expose_bin_window), (ev_view_class_init), (ev_view_init): Use normal style color for the widget background and draw a black box around the page.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index cd3d666..2ff80f1 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -223,6 +223,9 @@ ev_view_size_request (GtkWidget *widget,
requisition->width = 10;
requisition->height = 10;
}
+
+ requisition->width += 2;
+ requisition->height += 2;
}
}
@@ -246,17 +249,6 @@ ev_view_size_allocate (GtkWidget *widget,
}
static void
-update_window_backgrounds (EvView *view)
-{
- GtkWidget *widget = GTK_WIDGET (view);
-
- if (GTK_WIDGET_REALIZED (view)) {
- gdk_window_set_background (view->bin_window,
- &widget->style->base[GTK_WIDGET_STATE (widget)]);
- }
-}
-
-static void
ev_view_realize (GtkWidget *widget)
{
EvView *view = EV_VIEW (widget);
@@ -302,6 +294,9 @@ ev_view_realize (GtkWidget *widget)
gdk_window_set_user_data (view->bin_window, widget);
gdk_window_show (view->bin_window);
+ widget->style = gtk_style_attach (widget->style, view->bin_window);
+ gtk_style_set_background (widget->style, view->bin_window, GTK_STATE_NORMAL);
+
if (view->document) {
ev_document_set_target (view->document, view->bin_window);
@@ -312,8 +307,6 @@ ev_view_realize (GtkWidget *widget)
*/
gtk_widget_queue_resize (widget);
}
-
- update_window_backgrounds (view);
}
static void
@@ -331,20 +324,6 @@ ev_view_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (ev_view_parent_class)->unrealize (widget);
}
-static void
-ev_view_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- update_window_backgrounds (EV_VIEW (widget));
-}
-
-static void
-ev_view_state_changed (GtkWidget *widget,
- GtkStateType previous_state)
-{
- update_window_backgrounds (EV_VIEW (widget));
-}
-
static guint32
ev_gdk_color_to_rgb (const GdkColor *color)
{
@@ -406,7 +385,17 @@ expose_bin_window (GtkWidget *widget,
widget->requisition.width) / 2);
y_offset = MAX (0, (widget->allocation.height -
widget->requisition.height) / 2);
- ev_document_set_page_offset (view->document, x_offset, y_offset);
+ gdk_draw_rectangle (view->bin_window,
+ widget->style->black_gc,
+ FALSE,
+ x_offset,
+ y_offset,
+ widget->requisition.width - 1,
+ widget->requisition.height - 1);
+
+ ev_document_set_page_offset (view->document,
+ x_offset + 1,
+ y_offset + 1);
ev_document_render (view->document,
event->area.x, event->area.y,
@@ -856,8 +845,6 @@ ev_view_class_init (EvViewClass *class)
widget_class->size_allocate = ev_view_size_allocate;
widget_class->realize = ev_view_realize;
widget_class->unrealize = ev_view_unrealize;
- widget_class->style_set = ev_view_style_set;
- widget_class->state_changed = ev_view_state_changed;
gtk_object_class->destroy = ev_view_destroy;
class->set_scroll_adjustments = ev_view_set_scroll_adjustments;
@@ -920,16 +907,12 @@ ev_view_class_init (EvViewClass *class)
static void
ev_view_init (EvView *view)
{
- static const GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
-
GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
view->scale = 1.0;
view->pressed_button = -1;
view->cursor = EV_VIEW_CURSOR_NORMAL;
- gtk_widget_modify_bg (GTK_WIDGET (view), GTK_STATE_NORMAL, &white);
-
view->find_results = g_array_new (FALSE,
FALSE,
sizeof (EvFindResult));