Add tracking of open windows to nsgtk

svn path=/trunk/netsurf/; revision=2789
This commit is contained in:
Rob Kendrick 2006-07-21 10:50:11 +00:00
parent dad7a41e93
commit dfd0110726
1 changed files with 23 additions and 3 deletions

View File

@ -51,6 +51,9 @@ struct gui_window {
GtkWidget *history_window_widget;
int caretx, carety, careth;
int last_x, last_y;
struct gui_window *prev;
struct gui_window *next;
};
struct gtk_history_window {
@ -64,6 +67,8 @@ GdkGC *current_gc;
#ifdef CAIRO_VERSION
cairo_t *current_cr;
#endif
struct gui_window *window_list = 0;
static int open_windows = 0;
/* functions used by below event handlers */
@ -99,7 +104,6 @@ void nsgtk_window_size_allocate_event(GtkWidget *widget,
gboolean nsgtk_window_keypress_event(GtkWidget *widget,
GdkEventKey *event, gpointer data);
/* local history window event handlers */
gboolean nsgtk_history_expose_event(GtkWidget *widget,
GdkEventExpose *event, gpointer data);
@ -136,6 +140,13 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
return 0;
}
g->prev = 0;
g->next = window_list;
if (window_list)
window_list->prev = g;
window_list = g;
open_windows++;
/* a height of zero means no caret */
g->careth = 0;
@ -347,7 +358,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
schedule(5, nsgtk_pass_mouse_position, g);
}
open_windows++;
return g;
}
@ -655,9 +665,19 @@ gboolean nsgtk_window_button_press_event(GtkWidget *widget,
return TRUE;
}
void gui_window_destroy(struct gui_window *g)
void gui_window_destroy(struct gui_window *data)
{
/* XXX: Destroy history window etc here */
struct gui_window *g = data;
if (g->prev)
g->prev->next = g->next;
else
window_list = g->next;
if (g->next)
g->next->prev = g->prev;
}