Author: dsilvers
Date: Mon Aug 14 23:49:07 2006
New Revision: 2847
URL:
http://svn.semichrome.net?rev=2847&view=rev
Log:
Cleanups, also fix scrollbar mis-sizing on URL change and ensure zooms work properly
Modified:
branches/rjek/glade/gtk/gtk_window.c
Modified: branches/rjek/glade/gtk/gtk_window.c
URL:
http://svn.semichrome.net/branches/rjek/glade/gtk/gtk_window.c?rev=2847&a...
==============================================================================
--- branches/rjek/glade/gtk/gtk_window.c (original)
+++ branches/rjek/glade/gtk/gtk_window.c Mon Aug 14 23:49:07 2006
@@ -38,6 +38,7 @@
GtkWindow *window;
GtkEntry *url_bar;
GtkDrawingArea *drawing_area;
+ GtkViewport *viewport;
GtkLabel *status_bar;
GtkToolButton *back_button;
GtkToolButton *forward_button;
@@ -88,8 +89,6 @@
static void nsgtk_window_destroy_event(GtkWidget *, gpointer);
static gboolean nsgtk_window_expose_event(GtkWidget *, GdkEventExpose *,
gpointer);
-static gboolean nsgtk_window_configure_event(GtkWidget *, GdkEventConfigure *,
- gpointer);
static gboolean nsgtk_window_motion_notify_event(GtkWidget *, GdkEventMotion *,
gpointer);
static gboolean nsgtk_window_button_press_event(GtkWidget *, GdkEventButton *,
@@ -177,7 +176,7 @@
/* help menu */
MENUEVENT(about),
- /* sentinal */
+ /* sentinel */
{ NULL, NULL }
};
@@ -282,26 +281,6 @@
return FALSE;
}
-gboolean nsgtk_window_configure_event(GtkWidget *widget,
- GdkEventConfigure *event, gpointer data)
-{
- struct gui_window *g = data;
-
- if (gui_in_multitask)
- return FALSE;
-
- if (!g->bw->current_content)
- return FALSE;
-
- if (g->bw->current_content->status != CONTENT_STATUS_READY &&
- g->bw->current_content->status != CONTENT_STATUS_DONE)
- return FALSE;
-
- content_reformat(g->bw->current_content, event->width, event->height);
-
- return FALSE;
-}
-
gboolean nsgtk_window_motion_notify_event(GtkWidget *widget,
GdkEventMotion *event, gpointer data)
{
@@ -321,7 +300,7 @@
{
struct gui_window *g = data;
int button = BROWSER_MOUSE_CLICK_1;
-
+
if (event->button == 2) /* 2 == middle button on X */
button = BROWSER_MOUSE_CLICK_2;
@@ -374,7 +353,7 @@
return;
content_reformat(g->bw->current_content,
- g->target_width, g->target_height);
+ g->target_width, g->target_height);
if (GTK_WIDGET_SENSITIVE((GTK_WIDGET(g->stop_button))))
schedule(100, nsgtk_perform_deferred_resize, g);
@@ -475,7 +454,7 @@
gboolean nsgtk_window_home_button_clicked(GtkWidget *widget, gpointer data)
{
struct gui_window *g = data;
- const char *addr = "http://netsurf.sourceforge.net/";
+ static const char *addr = "http://netsurf.sourceforge.net/";
if (option_homepage_url != NULL)
addr = option_homepage_url;
@@ -687,13 +666,14 @@
g->stop_menu = GTK_MENU_ITEM(GET_WIDGET("stop"));
g->reload_menu = GTK_MENU_ITEM(GET_WIDGET("reload"));
g->throbber = GTK_IMAGE(GET_WIDGET("throbber"));
-
+ g->viewport = GTK_VIEWPORT(GET_WIDGET("viewport1"));
/* connect our scrollbars to the viewport */
- gtk_viewport_set_hadjustment(GTK_VIEWPORT(GET_WIDGET("viewport1")),
+
+ gtk_viewport_set_hadjustment(g->viewport,
gtk_range_get_adjustment(GTK_RANGE(GET_WIDGET("hscrollbar1"))));
- gtk_viewport_set_vadjustment(GTK_VIEWPORT(GET_WIDGET("viewport1")),
+ gtk_viewport_set_vadjustment(g->viewport,
gtk_range_get_adjustment(GTK_RANGE(GET_WIDGET("vscrollbar1"))));
- gtk_widget_set_size_request(GTK_WIDGET(GET_WIDGET("viewport1")), 0, 0);
+ gtk_widget_set_size_request(g->viewport, 0, 0);
/* set the URL entry box to expand, as we can't do this from within
* glade because of the way it emulates toolbars.
@@ -774,8 +754,6 @@
/* connect signals to handlers. */
CONNECT(g->window, "destroy", nsgtk_window_destroy_event, g);
CONNECT(g->drawing_area, "expose_event", nsgtk_window_expose_event, g);
- CONNECT(g->drawing_area, "configure_event",
- nsgtk_window_configure_event, g);
CONNECT(g->drawing_area, "motion_notify_event",
nsgtk_window_motion_notify_event, g);
CONNECT(g->drawing_area, "button_press_event",
@@ -815,7 +793,7 @@
void gui_window_set_title(struct gui_window *g, const char *title)
{
- char suffix[] = " - NetSurf";
+ static char suffix[] = " - NetSurf";
char nt[strlen(title) + strlen(suffix) + 1];
if (title == NULL || title[0] == '\0')
@@ -834,7 +812,7 @@
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
{
gtk_widget_queue_draw_area(GTK_WIDGET(g->drawing_area),
- x0, y0, x1-x0+1, y1-y0+1);
+ x0, y0, x1-x0+1, y1-y0+1);
}
void gui_window_redraw_window(struct gui_window *g)
@@ -843,7 +821,7 @@
}
void gui_window_update_box(struct gui_window *g,
- const union content_msg_data *data)
+ const union content_msg_data *data)
{
struct content *c = g->bw->current_content;
@@ -880,7 +858,8 @@
void gui_window_set_extent(struct gui_window *g, int width, int height)
{
gtk_widget_set_size_request(GTK_WIDGET(g->drawing_area),
- width * g->scale, height * g->scale);
+ width * g->scale, height * g->scale);
+ gtk_widget_set_size_request(g->viewport, 0, 0);
}
void gui_window_set_status(struct gui_window *g, const char *text)
@@ -1004,6 +983,8 @@
schedule_remove(nsgtk_throb, g);
gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[0]);
+ // Issue a final reflow so that the content object reports its size correctly
+ schedule(5, nsgtk_perform_deferred_resize, g);
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)