NetSurf
Data Structures | Macros | Functions | Variables
window.c File Reference

Implementation of gtk windowing. More...

#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#include <math.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
#include "netsurf/inttypes.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "netsurf/form.h"
#include "netsurf/keypress.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "gtk/selection.h"
#include "gtk/warn.h"
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
#include "gtk/toolbar_items.h"
#include "gtk/toolbar.h"
#include "gtk/local_history.h"
#include "gtk/plotters.h"
#include "gtk/schedule.h"
#include "gtk/tabs.h"
#include "gtk/bitmap.h"
#include "gtk/gdk.h"
#include "gtk/resources.h"
#include "gtk/search.h"
#include "gtk/throbber.h"
#include "gtk/window.h"
Include dependency graph for window.c:

Go to the source code of this file.

Data Structures

struct  gui_window
 first entry in window list More...
 

Macros

#define THROBBER_FRAME_TIME   (100)
 time (in ms) between throbber animation frame updates More...
 
#define CONNECT(obj, sig, callback, ptr)    g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
 

Functions

static void nsgtk_select_menu_clicked (GtkCheckMenuItem *checkmenuitem, gpointer user_data)
 
static gboolean nsgtk_window_draw_event (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 
static gboolean nsgtk_window_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer data)
 
static gboolean nsgtk_window_focus_out_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 GTK signal handler for focus-out-event on layout. More...
 
static gboolean nsgtk_window_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data)
 GTK signal handler for button-press-event on layout. More...
 
static gboolean nsgtk_window_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer data)
 
static gboolean nsgtk_window_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer data)
 
static gboolean nsgtk_window_keypress_event (GtkWidget *widget, GdkEventKey *event, gpointer data)
 
static gboolean nsgtk_window_keyrelease_event (GtkWidget *widget, GdkEventKey *event, gpointer data)
 
static void nsgtk_window_input_method_commit (GtkIMContext *ctx, const gchar *str, gpointer data)
 
static gboolean nsgtk_window_size_allocate_event (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
 
static void nsgtk_paned_notify__position (GObject *gobject, GParamSpec *pspec, gpointer data)
 when the pane position is changed update the user option More...
 
static gboolean nsgtk_paned_size_allocate_event (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
 Set status bar / scroll bar proportion according to user option when pane is resized. More...
 
static void window_destroy (GtkWidget *widget, gpointer data)
 handler for gtk destroy signal on window container More...
 
static struct browser_windowbw_from_gw (void *data)
 
static bool get_tool_bar_show (void)
 
static void next_throbber_frame (void *p)
 Make the throbber advance to next frame. More...
 
static struct gui_windowgui_window_create (struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
 Create and open a gtk container (window or tab) for a browsing context. More...
 
static void gui_window_destroy (struct gui_window *gw)
 
static void gui_window_set_icon (struct gui_window *gw, struct hlcache_handle *icon)
 favicon setting for gtk gui window. More...
 
static bool gui_window_get_scroll (struct gui_window *g, int *sx, int *sy)
 
static void nsgtk_redraw_caret (struct gui_window *g)
 
static void gui_window_remove_caret (struct gui_window *g)
 
static nserror nsgtk_window_invalidate_area (struct gui_window *g, const struct rect *rect)
 Invalidates an area of a GTK browser window. More...
 
static void gui_window_set_status (struct gui_window *g, const char *text)
 
static nserror gui_window_set_scroll (struct gui_window *g, const struct rect *rect)
 Set the scroll position of a gtk browser window. More...
 
static void gui_window_update_extent (struct gui_window *g)
 
static void gui_window_set_pointer (struct gui_window *g, gui_pointer_shape shape)
 
static void gui_window_place_caret (struct gui_window *g, int x, int y, int height, const struct rect *clip)
 
static nserror gui_window_get_dimensions (struct gui_window *gw, int *width, int *height)
 Find the current dimensions of a GTK browser window content area. More...
 
static void gui_window_start_selection (struct gui_window *g)
 
static void gui_window_create_form_select_menu (struct gui_window *g, struct form_control *control)
 
static void gui_window_file_gadget_open (struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget)
 GTK window UI callback when core needs a file selection gadget. More...
 
static nserror throbber (struct gui_window *gw, bool active)
 handle throbber changing state More...
 
static nserror page_info_change (struct gui_window *gw)
 handle page info changing More...
 
static nserror gui_window_event (struct gui_window *gw, enum gui_window_event event)
 GTK window UI callback to process miscellaneous events. More...
 
static nserror gui_window_set_url (struct gui_window *gw, nsurl *url)
 GTK window UI callback when core changes the current url. More...
 
static void gui_window_set_title (struct gui_window *gw, const char *title)
 GTK window UI callback when core changes the current title. More...
 
static nserror gui_search_web_provider_update (const char *name, struct bitmap *bitmap)
 GTK UI callback when search provider details are updated. More...
 
struct nsgtk_scaffoldingnsgtk_get_scaffold (struct gui_window *g)
 get containing nsgtk scaffolding handle from gui window handle More...
 
struct browser_windownsgtk_get_browser_window (struct gui_window *g)
 get core browsing context from gui window handle More...
 
GtkLayout * nsgtk_window_get_layout (struct gui_window *g)
 get gtk layout from gui handle More...
 
nserror nsgtk_window_search_toggle (struct gui_window *gw)
 toggle search visibility More...
 
nserror nsgtk_window_item_activate (struct gui_window *gw, nsgtk_toolbar_button itemid)
 activate the handler for a item in a toolbar of a gui window More...
 
void nsgtk_window_destroy_browser (struct gui_window *gw)
 destroy browsing context More...
 
nserror nsgtk_window_update_all (void)
 Every window will have its tab, toolbar and drawing area updated. More...
 
nserror nsgtk_window_toolbar_show (struct nsgtk_scaffolding *gs, bool show)
 Windows associated with a scaffold will have their toolbar show state set. More...
 
nserror nsgtk_window_toolbar_update (void)
 every window will have its toolbar updated to reflect user settings More...
 
nserror nsgtk_window_position_page_info (struct gui_window *gw, struct nsgtk_pi_window *win)
 position page_info appropriately More...
 
nserror nsgtk_window_position_local_history (struct gui_window *gw)
 position local_history appropriately More...
 

Variables

static GtkWidget * select_menu
 
static struct form_controlselect_menu_control
 
struct gui_windowwindow_list = NULL
 
static struct gui_search_web_table search_web_table
 GTK frontend web search operation table. More...
 
struct gui_search_web_tablensgtk_search_web_table = &search_web_table
 
static struct gui_window_table window_table
 GTK frontend browser window operation table. More...
 
struct gui_window_tablensgtk_window_table = &window_table
 

Detailed Description

Implementation of gtk windowing.

Definition in file window.c.

Macro Definition Documentation

◆ CONNECT

#define CONNECT (   obj,
  sig,
  callback,
  ptr 
)     g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))

◆ THROBBER_FRAME_TIME

#define THROBBER_FRAME_TIME   (100)

time (in ms) between throbber animation frame updates

Definition at line 72 of file window.c.

Function Documentation

◆ bw_from_gw()

static struct browser_window * bw_from_gw ( void *  data)
static

Definition at line 751 of file window.c.

References gui_window::bw.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ get_tool_bar_show()

static bool get_tool_bar_show ( void  )
static

Definition at line 758 of file window.c.

References nsoption_charp.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ gui_search_web_provider_update()

static nserror gui_search_web_provider_update ( const char *  name,
struct bitmap bitmap 
)
static

GTK UI callback when search provider details are updated.

Parameters
nameThe providers name.
bitmapThe bitmap representing the provider.
Returns
NSERROR_OK on success else error code.

Definition at line 1553 of file window.c.

References gui_window::next, NSERROR_OK, nsgdk_pixbuf_get_from_surface(), nsgtk_toolbar_set_websearch_image(), bitmap::surface, gui_window::toolbar, and window_list.

Here is the call graph for this function:

◆ gui_window_create()

static struct gui_window * gui_window_create ( struct browser_window bw,
struct gui_window existing,
gui_window_create_flags  flags 
)
static

Create and open a gtk container (window or tab) for a browsing context.

Parameters
bwThe browsing context to create gui_window for.
existingAn existing gui_window, may be NULL
flagsflags to control the container creation
Returns
gui window, or NULL on error

If GW_CREATE_CLONE flag is set existing is non-NULL.

Front end's gui_window must include a reference to the browser window passed in the bw param.

Definition at line 817 of file window.c.

References gui_window::bw, bw_from_gw(), CONNECT, gui_window::container, gui_window::current_pointer, favicon_pixbuf, get_tool_bar_show(), gui_window::grid, GTK_STATE_FLAG_NORMAL, GUI_POINTER_DEFAULT, GW_CREATE_FOCUS_LOCATION, GW_CREATE_FOREGROUND, GW_CREATE_TAB, gui_window::icon, gui_window::input_method, gui_window::layout, messages_get(), gui_window::mouse, gui_window::next, NSERROR_OK, nsgtk_builder_new_from_resname(), nsgtk_connect_draw_event(), nsgtk_current_scaffolding(), nsgtk_layout_get_bin_window(), nsgtk_new_scaffolding(), nsgtk_paned_notify__position(), nsgtk_paned_size_allocate_event(), nsgtk_search_create(), nsgtk_search_toggle_visibility(), nsgtk_tab_add(), nsgtk_toolbar_create(), nsgtk_toolbar_show(), nsgtk_warning(), nsgtk_widget_override_background_color(), nsgtk_widget_set_can_focus(), nsgtk_window_button_press_event(), nsgtk_window_button_release_event(), nsgtk_window_draw_event(), nsgtk_window_focus_out_event(), nsgtk_window_input_method_commit(), nsgtk_window_item_activate(), nsgtk_window_keypress_event(), nsgtk_window_keyrelease_event(), nsgtk_window_motion_notify_event(), nsgtk_window_scroll_event(), nsgtk_window_size_allocate_event(), NSLOG, nsoption_bool, OPENLOCATION_BUTTON, gui_window::paned, gui_window::prev, gui_window::scaffold, gui_window::search, gui_window::state, gui_window::status_bar, gui_window::toolbar, window_destroy(), and window_list.

Here is the call graph for this function:

◆ gui_window_create_form_select_menu()

static void gui_window_create_form_select_menu ( struct gui_window g,
struct form_control control 
)
static

Definition at line 1357 of file window.c.

References form_select_get_option(), nsgtk_menu_popup_at_pointer(), nsgtk_select_menu_clicked(), NSLOG, select_menu, select_menu_control, form_option::selected, and form_option::text.

Here is the call graph for this function:

◆ gui_window_destroy()

static void gui_window_destroy ( struct gui_window gw)
static

Definition at line 1002 of file window.c.

References gui_window::bw, gui_window::next, next_throbber_frame(), nsgtk_schedule(), NSLOG, gui_window::prev, gui_window::scaffold, and window_list.

Here is the call graph for this function:

◆ gui_window_event()

static nserror gui_window_event ( struct gui_window gw,
enum gui_window_event  event 
)
static

GTK window UI callback to process miscellaneous events.

Parameters
gwThe window receiving the event.
eventThe event code.
Returns
NSERROR_OK when processed ok

Definition at line 1483 of file window.c.

References gui_window_remove_caret(), gui_window_start_selection(), gui_window_update_extent(), GW_EVENT_PAGE_INFO_CHANGE, GW_EVENT_REMOVE_CARET, GW_EVENT_START_SELECTION, GW_EVENT_START_THROBBER, GW_EVENT_STOP_THROBBER, GW_EVENT_UPDATE_EXTENT, NSERROR_OK, page_info_change(), and throbber().

Here is the call graph for this function:

◆ gui_window_file_gadget_open()

static void gui_window_file_gadget_open ( struct gui_window g,
struct hlcache_handle hl,
struct form_control gadget 
)
static

GTK window UI callback when core needs a file selection gadget.

Parameters
gThe gui window on which the gadget has been requested

Definition at line 1415 of file window.c.

References browser_window_set_gadget_filename(), gui_window::bw, dialog, nsgtk_scaffolding_window(), NSGTK_STOCK_CANCEL, NSGTK_STOCK_OPEN, NSLOG, and gui_window::scaffold.

Here is the call graph for this function:

◆ gui_window_get_dimensions()

static nserror gui_window_get_dimensions ( struct gui_window gw,
int *  width,
int *  height 
)
static

Find the current dimensions of a GTK browser window content area.

Parameters
gwThe gui window to measure content area of.
widthreceives width of window
heightreceives height of window
Returns
NSERROR_OK on sucess and width and height updated else error code.
Todo:
consider gtk_widget_get_allocated_width()

Definition at line 1336 of file window.c.

References height, gui_window::layout, NSERROR_OK, nsgtk_widget_get_allocation(), and width.

Here is the call graph for this function:

◆ gui_window_get_scroll()

static bool gui_window_get_scroll ( struct gui_window g,
int *  sx,
int *  sy 
)
static

Definition at line 1065 of file window.c.

References gui_window::layout, nsgtk_layout_get_hadjustment(), and nsgtk_layout_get_vadjustment().

Referenced by gui_window_remove_caret(), nsgtk_redraw_caret(), and nsgtk_window_invalidate_area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_place_caret()

static void gui_window_place_caret ( struct gui_window g,
int  x,
int  y,
int  height,
const struct rect clip 
)
static

Definition at line 1298 of file window.c.

References gui_window::careth, gui_window::caretx, gui_window::carety, clip(), height, gui_window::layout, and nsgtk_redraw_caret().

Here is the call graph for this function:

◆ gui_window_remove_caret()

static void gui_window_remove_caret ( struct gui_window g)
static

Definition at line 1095 of file window.c.

References gui_window::careth, gui_window::caretx, gui_window::carety, gui_window_get_scroll(), and gui_window::layout.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_set_icon()

static void gui_window_set_icon ( struct gui_window gw,
struct hlcache_handle icon 
)
static

favicon setting for gtk gui window.

Parameters
gwgtk gui window to set favicon on.
iconA handle to the new favicon content.

Definition at line 1034 of file window.c.

References gui_window::container, content_get_bitmap(), favicon_pixbuf, gui_window::icon, nsgdk_pixbuf_get_from_surface(), nsgtk_tab_set_icon(), NSLOG, bitmap::surface, and gui_window::throb_frame.

Here is the call graph for this function:

◆ gui_window_set_pointer()

static void gui_window_set_pointer ( struct gui_window g,
gui_pointer_shape  shape 
)
static

◆ gui_window_set_scroll()

static nserror gui_window_set_scroll ( struct gui_window g,
const struct rect rect 
)
static

Set the scroll position of a gtk browser window.

Scrolls the viewport to ensure the specified rectangle of the content is shown. The GTK implementation scrolls the contents so the specified point in the content is at the top of the viewport.

Parameters
ggui window to scroll
rectThe rectangle to ensure is shown.
Returns
NSERROR_OK on success or apropriate error code.

Definition at line 1166 of file window.c.

References gui_window::layout, NSERROR_OK, nsgtk_layout_get_hadjustment(), nsgtk_layout_get_vadjustment(), rect::x0, and rect::y0.

Here is the call graph for this function:

◆ gui_window_set_status()

static void gui_window_set_status ( struct gui_window g,
const char *  text 
)
static

Definition at line 1146 of file window.c.

References gui_window::status_bar, and text().

Here is the call graph for this function:

◆ gui_window_set_title()

static void gui_window_set_title ( struct gui_window gw,
const char *  title 
)
static

GTK window UI callback when core changes the current title.

Parameters
gwThe gui window on which the url has been set.
urlThe new url.

Definition at line 1535 of file window.c.

References gui_window::container, nsgtk_scaffolding_set_title(), and nsgtk_tab_set_title().

Here is the call graph for this function:

◆ gui_window_set_url()

static nserror gui_window_set_url ( struct gui_window gw,
nsurl url 
)
static

GTK window UI callback when core changes the current url.

Parameters
gwThe gui window on which the url has been set.
urlThe new url.

Definition at line 1523 of file window.c.

References nsgtk_toolbar_set_url(), and gui_window::toolbar.

Here is the call graph for this function:

◆ gui_window_start_selection()

static void gui_window_start_selection ( struct gui_window g)
static

Definition at line 1350 of file window.c.

References gui_window::layout.

Referenced by gui_window_event().

Here is the caller graph for this function:

◆ gui_window_update_extent()

static void gui_window_update_extent ( struct gui_window g)
static

Definition at line 1200 of file window.c.

References browser_window_get_extents(), gui_window::bw, gui_window::grid, gui_window::layout, and NSERROR_OK.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_throbber_frame()

static void next_throbber_frame ( void *  p)
static

Make the throbber advance to next frame.

scheduled callback to update the throbber

Parameters
pThe context passed when scheduled.

Definition at line 781 of file window.c.

References gui_window::container, next_throbber_frame(), NSERROR_BAD_SIZE, NSERROR_OK, nsgtk_schedule(), nsgtk_tab_set_icon(), nsgtk_throbber_get_frame(), gui_window::throb_frame, and THROBBER_FRAME_TIME.

Referenced by gui_window_destroy(), next_throbber_frame(), and throbber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_get_browser_window()

struct browser_window * nsgtk_get_browser_window ( struct gui_window gw)

get core browsing context from gui window handle

Parameters
gwgui window handle

Definition at line 1619 of file window.c.

References gui_window::bw.

Referenced by nsgtk_on_link_opentab_activate_menu(), nsgtk_on_link_openwin_activate_menu(), nsgtk_on_savelink_activate_menu(), nsgtk_scaffolding_context_menu(), nsgtk_scaffolding_set_top_level(), nsgtk_scaffolding_update_edit_actions_sensitivity(), and scaffolding_update_context().

Here is the caller graph for this function:

◆ nsgtk_get_scaffold()

struct nsgtk_scaffolding * nsgtk_get_scaffold ( struct gui_window gw)

get containing nsgtk scaffolding handle from gui window handle

Parameters
gwgui window handle

Definition at line 1612 of file window.c.

References gui_window::scaffold.

Referenced by gui_download_window_create(), nsgtk_scaffolding_set_title(), nsgtk_scaffolding_set_top_level(), nsgtk_scaffolding_throbber(), nsgtk_tab_add(), openmenu_button_clicked_cb(), and toolbar_popup_context_menu_cb().

Here is the caller graph for this function:

◆ nsgtk_paned_notify__position()

static void nsgtk_paned_notify__position ( GObject *  gobject,
GParamSpec *  pspec,
gpointer  data 
)
static

when the pane position is changed update the user option

The slightly awkward implementation with the first allocation flag is necessary because the initial window creation does not cause an allocate-event signal so the position value in the pane is incorrect and we cannot know what it should be until after the allocation (which did not generate a signal) is done as the user position is a percentage of pane total width not an absolute value.

Definition at line 692 of file window.c.

References nsoption_int, nsoption_set_int, gui_window::paned, and gui_window::paned_sized.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ nsgtk_paned_size_allocate_event()

static gboolean nsgtk_paned_size_allocate_event ( GtkWidget *  widget,
GtkAllocation *  allocation,
gpointer  data 
)
static

Set status bar / scroll bar proportion according to user option when pane is resized.

Definition at line 717 of file window.c.

References nsoption_int.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ nsgtk_redraw_caret()

static void nsgtk_redraw_caret ( struct gui_window g)
static

Definition at line 1080 of file window.c.

References gui_window::careth, gui_window::caretx, gui_window::carety, gui_window_get_scroll(), and gui_window::layout.

Referenced by gui_window_place_caret().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_select_menu_clicked()

static void nsgtk_select_menu_clicked ( GtkCheckMenuItem *  checkmenuitem,
gpointer  user_data 
)
static

Definition at line 150 of file window.c.

References form_select_process_selection(), and select_menu_control.

Referenced by gui_window_create_form_select_menu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_button_press_event()

static gboolean nsgtk_window_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
)
static

GTK signal handler for button-press-event on layout.

Todo:
determine if hiding the caret here is necessary

Definition at line 325 of file window.c.

References BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, BROWSER_MOUSE_TRIPLE_CLICK, browser_window_mouse_click(), browser_window_remove_caret(), gui_window::bw, gui_window::input_method, gui_window::last_x, gui_window::last_y, gui_window::layout, gui_window::mouse, nsgtk_local_history_hide(), nsgtk_scaffolding_context_menu(), gui_window::pressed_x, gui_window::pressed_y, gui_window::scaffold, and gui_window::state.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_button_release_event()

static gboolean nsgtk_window_button_release_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  data 
)
static

Definition at line 386 of file window.c.

References BACK_BUTTON, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, browser_window_mouse_click(), browser_window_mouse_track(), gui_window::bw, FORWARD_BUTTON, gui_window::mouse, nsgtk_toolbar_item_activate(), NSLOG, gui_window::state, gui_window::toolbar, and browser_window::x.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_destroy_browser()

void nsgtk_window_destroy_browser ( struct gui_window gw)

destroy browsing context

Parameters
gwgui window handle

Definition at line 1649 of file window.c.

References gui_window::container.

Referenced by nsgtk_tab_close_current().

Here is the caller graph for this function:

◆ nsgtk_window_draw_event()

static gboolean nsgtk_window_draw_event ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  data 
)
static

Definition at line 212 of file window.c.

References browser_window_redraw(), gui_window::bw, gui_window::careth, gui_window::caretx, gui_window::carety, clip(), current_cr, redraw_context::interactive, gui_window::layout, gui_window::next, nsgtk_layout_get_bin_window(), nsgtk_plot_caret(), nsgtk_plotters, and window_list.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_focus_out_event()

static gboolean nsgtk_window_focus_out_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)
static

GTK signal handler for focus-out-event on layout.

when focus leaves the layout widget ensure the caret is cleared

Definition at line 311 of file window.c.

References browser_window_remove_caret(), and gui_window::bw.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_get_layout()

GtkLayout * nsgtk_window_get_layout ( struct gui_window gw)

get gtk layout from gui handle

Parameters
gwgui window handle

Definition at line 1626 of file window.c.

References gui_window::layout.

◆ nsgtk_window_input_method_commit()

static void nsgtk_window_input_method_commit ( GtkIMContext *  ctx,
const gchar *  str,
gpointer  data 
)
static

Definition at line 651 of file window.c.

References browser_window_key_press(), gui_window::bw, utf8_next(), and utf8_to_ucs4().

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_invalidate_area()

static nserror nsgtk_window_invalidate_area ( struct gui_window g,
const struct rect rect 
)
static

Invalidates an area of a GTK browser window.

Parameters
ggui_window
rectarea to redraw or NULL for the entire window area
Returns
NSERROR_OK on success or appropriate error code

Definition at line 1121 of file window.c.

References browser_window_has_content(), gui_window::bw, gui_window_get_scroll(), gui_window::layout, NSERROR_OK, rect::x0, rect::x1, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ nsgtk_window_item_activate()

nserror nsgtk_window_item_activate ( struct gui_window gw,
nsgtk_toolbar_button  itemid 
)

activate the handler for a item in a toolbar of a gui window

Parameters
gwThe gui window handle
itemidThe id of the item to activate

Definition at line 1642 of file window.c.

References nsgtk_toolbar_item_activate(), and gui_window::toolbar.

Referenced by gui_window_create(), and nsgtk_tab_switch_page_after().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_keypress_event()

static gboolean nsgtk_window_keypress_event ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)
static

Definition at line 520 of file window.c.

References browser_window_key_press(), gui_window::bw, GDK_KEY, gtk_gui_gdkkey_to_nskey(), gui_window::hscroll, gui_window::input_method, gui_window::layout, nsgtk_adjustment_get_lower(), nsgtk_adjustment_get_page_increment(), nsgtk_adjustment_get_step_increment(), nsgtk_adjustment_get_upper(), nsgtk_layout_get_hadjustment(), nsgtk_layout_get_vadjustment(), nsgtk_widget_get_allocation(), and gui_window::vscroll.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_keyrelease_event()

static gboolean nsgtk_window_keyrelease_event ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)
static

Definition at line 640 of file window.c.

References gui_window::input_method.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ nsgtk_window_motion_notify_event()

static gboolean nsgtk_window_motion_notify_event ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  data 
)
static

Definition at line 252 of file window.c.

References BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOLDING_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, browser_window_mouse_click(), browser_window_mouse_track(), gui_window::bw, gui_window::last_x, gui_window::last_y, gui_window::mouse, gui_window::pressed_x, gui_window::pressed_y, and gui_window::state.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_position_local_history()

nserror nsgtk_window_position_local_history ( struct gui_window gw)

position local_history appropriately

Parameters
gwThe gui window handle to position relative to

Definition at line 1702 of file window.c.

References nsgtk_toolbar_position_local_history(), and gui_window::toolbar.

Referenced by nsgtk_scaffolding_position_local_history().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_position_page_info()

nserror nsgtk_window_position_page_info ( struct gui_window gw,
struct nsgtk_pi_window win 
)

position page_info appropriately

Parameters
gwThe gui window handle to position relative to
winThe page-info window to position

Definition at line 1695 of file window.c.

References nsgtk_toolbar_position_page_info(), and gui_window::toolbar.

Referenced by nsgtk_scaffolding_position_page_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_scroll_event()

static gboolean nsgtk_window_scroll_event ( GtkWidget *  widget,
GdkEventScroll *  event,
gpointer  data 
)
static

Definition at line 432 of file window.c.

References browser_window_scroll_at_point(), gui_window::bw, gui_window::hscroll, gui_window::layout, nsgtk_adjustment_get_lower(), nsgtk_adjustment_get_step_increment(), nsgtk_adjustment_get_upper(), nsgtk_layout_get_hadjustment(), nsgtk_layout_get_vadjustment(), nsgtk_widget_get_allocation(), NSLOG, gui_window::vscroll, and browser_window::x.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_search_toggle()

nserror nsgtk_window_search_toggle ( struct gui_window gw)

toggle search visibility

Parameters
gwgui window handle

Definition at line 1634 of file window.c.

References nsgtk_search_toggle_visibility(), and gui_window::search.

Referenced by nsgtk_on_find_activate_menu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_size_allocate_event()

static gboolean nsgtk_window_size_allocate_event ( GtkWidget *  widget,
GtkAllocation *  allocation,
gpointer  data 
)
static

Definition at line 669 of file window.c.

References browser_window_schedule_reformat(), and gui_window::bw.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_toolbar_show()

nserror nsgtk_window_toolbar_show ( struct nsgtk_scaffolding gs,
bool  show 
)

Windows associated with a scaffold will have their toolbar show state set.

Definition at line 1671 of file window.c.

References gui_window::next, NSERROR_OK, nsgtk_toolbar_show(), gui_window::scaffold, gui_window::toolbar, and window_list.

Referenced by nsgtk_on_toolbar_activate_menu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_toolbar_update()

nserror nsgtk_window_toolbar_update ( void  )

every window will have its toolbar updated to reflect user settings

Definition at line 1684 of file window.c.

References gui_window::next, NSERROR_OK, nsgtk_toolbar_update(), gui_window::toolbar, and window_list.

Referenced by customisation_apply_clicked_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsgtk_window_update_all()

nserror nsgtk_window_update_all ( void  )

Every window will have its tab, toolbar and drawing area updated.

The update will ensure the correct tab options are used, the toolbar size and style is changed and the browser window contents redrawn.

Definition at line 1657 of file window.c.

References browser_window_schedule_reformat(), gui_window::bw, gui_window::next, NSERROR_OK, nsgtk_scaffolding_notebook(), nsgtk_search_restyle(), nsgtk_tab_options_changed(), nsgtk_toolbar_restyle(), gui_window::scaffold, gui_window::search, gui_window::toolbar, and window_list.

Referenced by nsgtk_preferences_checkShowSingleTab_toggled(), nsgtk_preferences_comboButtonType_changed(), nsgtk_preferences_comboTabPosition_changed(), nsgtk_preferences_fontPreview_clicked(), and toggledebugging_button_clicked_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ page_info_change()

static nserror page_info_change ( struct gui_window gw)
static

handle page info changing

Definition at line 1469 of file window.c.

References NSERROR_OK, nsgtk_toolbar_page_info_change(), and gui_window::toolbar.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ throbber()

static nserror throbber ( struct gui_window gw,
bool  active 
)
static

handle throbber changing state

Definition at line 1450 of file window.c.

References gui_window::container, gui_window::icon, next_throbber_frame(), NSERROR_OK, nsgtk_scaffolding_throbber(), nsgtk_schedule(), nsgtk_tab_set_icon(), nsgtk_toolbar_throbber(), gui_window::throb_frame, THROBBER_FRAME_TIME, and gui_window::toolbar.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_destroy()

static void window_destroy ( GtkWidget *  widget,
gpointer  data 
)
static

handler for gtk destroy signal on window container

destroy the browsing context as there is will be nothing to display it now

Definition at line 733 of file window.c.

References browser_window_destroy(), gui_window::bw, gui_window::icon, and gui_window::input_method.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ nsgtk_search_web_table

struct gui_search_web_table* nsgtk_search_web_table = &search_web_table

Definition at line 1581 of file window.c.

Referenced by main().

◆ nsgtk_window_table

struct gui_window_table* nsgtk_window_table = &window_table

Definition at line 1608 of file window.c.

Referenced by main().

◆ search_web_table

struct gui_search_web_table search_web_table
static
Initial value:
= {
.provider_update = gui_search_web_provider_update,
}
static nserror gui_search_web_provider_update(const char *name, struct bitmap *bitmap)
GTK UI callback when search provider details are updated.
Definition: window.c:1553

GTK frontend web search operation table.

Definition at line 1577 of file window.c.

◆ select_menu

GtkWidget* select_menu
static

Definition at line 74 of file window.c.

Referenced by gui_window_create_form_select_menu().

◆ select_menu_control

struct form_control* select_menu_control
static

Definition at line 75 of file window.c.

Referenced by gui_window_create_form_select_menu(), and nsgtk_select_menu_clicked().

◆ window_list

struct gui_window* window_list = NULL

◆ window_table

struct gui_window_table window_table
static
Initial value:
= {
.create = gui_window_create,
.destroy = gui_window_destroy,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.event = gui_window_event,
.set_icon = gui_window_set_icon,
.set_title = gui_window_set_title,
.set_status = gui_window_set_status,
.set_pointer = gui_window_set_pointer,
.place_caret = gui_window_place_caret,
.create_form_select_menu = gui_window_create_form_select_menu,
.file_gadget_open = gui_window_file_gadget_open,
.set_url = gui_window_set_url,
}
static void gui_window_set_status(struct gui_window *g, const char *text)
Definition: window.c:1146
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
GTK window UI callback to process miscellaneous events.
Definition: window.c:1483
static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
Definition: window.c:1212
static nserror gui_window_get_dimensions(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a GTK browser window content area.
Definition: window.c:1336
static void gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *icon)
favicon setting for gtk gui window.
Definition: window.c:1034
static nserror nsgtk_window_invalidate_area(struct gui_window *g, const struct rect *rect)
Invalidates an area of a GTK browser window.
Definition: window.c:1121
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a gtk container (window or tab) for a browsing context.
Definition: window.c:817
static nserror gui_window_set_url(struct gui_window *gw, nsurl *url)
GTK window UI callback when core changes the current url.
Definition: window.c:1523
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Definition: window.c:1298
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
Definition: window.c:1065
static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
Set the scroll position of a gtk browser window.
Definition: window.c:1166
static void gui_window_set_title(struct gui_window *gw, const char *title)
GTK window UI callback when core changes the current title.
Definition: window.c:1535
static void gui_window_file_gadget_open(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget)
GTK window UI callback when core needs a file selection gadget.
Definition: window.c:1415
static void gui_window_create_form_select_menu(struct gui_window *g, struct form_control *control)
Definition: window.c:1357
static void gui_window_destroy(struct gui_window *gw)
Definition: window.c:1002

GTK frontend browser window operation table.

Definition at line 1587 of file window.c.