summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-06-27 13:59:25 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-06-27 13:59:25 +0000
commitca96353d9fac049057535ed7fdff19e43ac79666 (patch)
tree39237c6894679fc7434de9a490458c4d51227270 /gtk
parentfa99a7a3ce6aea22368c75d38866e4a95ab8fd84 (diff)
downloadnetsurf-ca96353d9fac049057535ed7fdff19e43ac79666.tar.gz
netsurf-ca96353d9fac049057535ed7fdff19e43ac79666.tar.bz2
Merged revisions 7764-7977,7979-8058 via svnmerge from
svn://svn.netsurf-browser.org/branches/paulblokus/textinput ........ r7769 | paulblokus | 2009-06-11 22:26:16 +0100 (Thu, 11 Jun 2009) | 4 lines replace global history window with an empty window for future tests add the necessary files first lines ported ........ r7771 | paulblokus | 2009-06-11 23:51:46 +0100 (Thu, 11 Jun 2009) | 1 line more functions ........ r7772 | paulblokus | 2009-06-12 02:07:36 +0100 (Fri, 12 Jun 2009) | 1 line redraw working ........ r7777 | paulblokus | 2009-06-12 11:35:45 +0100 (Fri, 12 Jun 2009) | 3 lines plotter fix make use of the provided clipping rectangle ........ r7781 | paulblokus | 2009-06-12 16:26:51 +0100 (Fri, 12 Jun 2009) | 3 lines callbacks for taxtarea to request a [caret]redraw basic caret handling drawing ........ r7782 | paulblokus | 2009-06-12 22:36:50 +0100 (Fri, 12 Jun 2009) | 1 line single character insertion ........ r7783 | paulblokus | 2009-06-12 22:41:37 +0100 (Fri, 12 Jun 2009) | 1 line single character insertion ........ r7784 | paulblokus | 2009-06-12 23:55:40 +0100 (Fri, 12 Jun 2009) | 3 lines fixed caret clipping arrows, delete and backspace ........ r7812 | paulblokus | 2009-06-16 14:55:41 +0100 (Tue, 16 Jun 2009) | 1 line remove bug causing NS hang on \n in textarea ........ r7816 | paulblokus | 2009-06-16 16:29:48 +0100 (Tue, 16 Jun 2009) | 1 line Enter, Home, End keys ........ r7817 | paulblokus | 2009-06-16 16:56:16 +0100 (Tue, 16 Jun 2009) | 1 line Ctrl + Home/End ........ r7818 | paulblokus | 2009-06-16 17:16:51 +0100 (Tue, 16 Jun 2009) | 1 line redraw caret only on caret moves ........ r7821 | paulblokus | 2009-06-16 20:18:30 +0100 (Tue, 16 Jun 2009) | 1 line line end/start delete ........ r7822 | paulblokus | 2009-06-16 23:43:42 +0100 (Tue, 16 Jun 2009) | 1 line selection drawing + select all ........ r7823 | paulblokus | 2009-06-17 02:31:07 +0100 (Wed, 17 Jun 2009) | 3 lines auto scrolling on caret moves clear selection ........ r7845 | paulblokus | 2009-06-18 17:35:03 +0100 (Thu, 18 Jun 2009) | 1 line page up/down ........ r7846 | paulblokus | 2009-06-18 17:38:45 +0100 (Thu, 18 Jun 2009) | 1 line remove unnecessary fix ........ r7847 | paulblokus | 2009-06-18 18:00:16 +0100 (Thu, 18 Jun 2009) | 1 line clipping fixes ........ r7849 | paulblokus | 2009-06-18 18:21:02 +0100 (Thu, 18 Jun 2009) | 1 line scroll fix ........ r7850 | paulblokus | 2009-06-18 18:45:13 +0100 (Thu, 18 Jun 2009) | 1 line simplified redraw request logic ........ r7855 | paulblokus | 2009-06-18 19:56:24 +0100 (Thu, 18 Jun 2009) | 1 line front end passing mouse events ........ r7858 | paulblokus | 2009-06-18 22:18:39 +0100 (Thu, 18 Jun 2009) | 3 lines drag selection bug fixes ........ r7860 | paulblokus | 2009-06-18 23:32:39 +0100 (Thu, 18 Jun 2009) | 3 lines take selection into account on keypress of different types a few bugs fixed ........ r7876 | paulblokus | 2009-06-19 13:43:07 +0100 (Fri, 19 Jun 2009) | 3 lines pango nsfont_split fix a few textarea fixes ........ r7879 | paulblokus | 2009-06-19 17:33:10 +0100 (Fri, 19 Jun 2009) | 4 lines newline handling seems to work this way clear selection on mouse click more bug fixes ........ r7880 | paulblokus | 2009-06-19 18:16:27 +0100 (Fri, 19 Jun 2009) | 3 lines no caret option selection follows drag ........ r7883 | paulblokus | 2009-06-19 19:08:44 +0100 (Fri, 19 Jun 2009) | 3 lines o width selection bug fix caret at correct side of drag selection ........ r7918 | paulblokus | 2009-06-22 21:01:28 +0100 (Mon, 22 Jun 2009) | 3 lines fix caret positioning at line end CR removal in input methods ........ r7919 | paulblokus | 2009-06-22 21:34:39 +0100 (Mon, 22 Jun 2009) | 1 line fix crash on 0 length text ........ r7926 | paulblokus | 2009-06-23 09:53:56 +0100 (Tue, 23 Jun 2009) | 3 lines change LF into spaces for single line widget text normalisation at one place ........ r7931 | paulblokus | 2009-06-23 10:51:25 +0100 (Tue, 23 Jun 2009) | 1 line cleanup ........ r7933 | paulblokus | 2009-06-23 11:17:22 +0100 (Tue, 23 Jun 2009) | 1 line fix selection draw ........ r7935 | paulblokus | 2009-06-23 11:41:30 +0100 (Tue, 23 Jun 2009) | 1 line guard readonly ........ r7942 | paulblokus | 2009-06-24 08:19:39 +0100 (Wed, 24 Jun 2009) | 1 line applied changes suggested by jmb ........ r7943 | paulblokus | 2009-06-24 09:04:49 +0100 (Wed, 24 Jun 2009) | 1 line little fixes ........ r7945 | paulblokus | 2009-06-24 12:50:14 +0100 (Wed, 24 Jun 2009) | 1 line correct line length and wrapping ........ r7947 | paulblokus | 2009-06-24 14:32:36 +0100 (Wed, 24 Jun 2009) | 3 lines fixed page up/down broken in last commit changed logic for caret positioning on soft breaks ........ r7949 | paulblokus | 2009-06-24 16:31:42 +0100 (Wed, 24 Jun 2009) | 1 line remove temporary/test code ........ r7975 | paulblokus | 2009-06-25 16:00:46 +0100 (Thu, 25 Jun 2009) | 1 line changes suggested by jmb ........ r7976 | paulblokus | 2009-06-25 16:33:23 +0100 (Thu, 25 Jun 2009) | 1 line added ro_ prefix to RISC OS textarea code ........ svn path=/trunk/netsurf/; revision=8060
Diffstat (limited to 'gtk')
-rw-r--r--gtk/font_pango.c1
-rw-r--r--gtk/gtk_gui.c70
-rw-r--r--gtk/gtk_gui.h3
-rw-r--r--gtk/gtk_plotters.c2
-rw-r--r--gtk/gtk_window.c43
5 files changed, 77 insertions, 42 deletions
diff --git a/gtk/font_pango.c b/gtk/font_pango.c
index e5994e71e..eda2f89c9 100644
--- a/gtk/font_pango.c
+++ b/gtk/font_pango.c
@@ -183,6 +183,7 @@ bool nsfont_split(const struct css_style *style,
pango_layout_set_width(layout, x * PANGO_SCALE);
pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
+ pango_layout_set_single_paragraph_mode(layout, true);
line = pango_layout_get_line(layout, 1);
if (line)
index = line->start_index - 1;
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c
index 763898186..b8217b7f1 100644
--- a/gtk/gtk_gui.c
+++ b/gtk/gtk_gui.c
@@ -43,6 +43,7 @@
#include "desktop/netsurf.h"
#include "desktop/options.h"
#include "desktop/save_pdf/pdf_plotters.h"
+#include "desktop/textinput.h"
#include "gtk/gtk_gui.h"
#include "gtk/dialogs/gtk_options.h"
#include "gtk/gtk_completion.h"
@@ -734,3 +735,72 @@ static void nsgtk_PDF_no_pass(GtkButton *w, gpointer data)
}
#endif
+uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
+{
+ /* this function will need to become much more complex to support
+ * everything that the RISC OS version does. But this will do for
+ * now. I hope.
+ */
+ switch (key->keyval)
+ {
+ case GDK_BackSpace:
+ if (key->state & GDK_SHIFT_MASK)
+ return KEY_DELETE_LINE_START;
+ else
+ return KEY_DELETE_LEFT;
+ case GDK_Delete:
+ if (key->state & GDK_SHIFT_MASK)
+ return KEY_DELETE_LINE_END;
+ else
+ return KEY_DELETE_RIGHT;
+ case GDK_Linefeed: return 13;
+ case GDK_Return: return 10;
+ case GDK_Left: return KEY_LEFT;
+ case GDK_Right: return KEY_RIGHT;
+ case GDK_Up: return KEY_UP;
+ case GDK_Down: return KEY_DOWN;
+ case GDK_Home:
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_TEXT_START;
+ else
+ return KEY_LINE_START;
+ case GDK_End:
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_TEXT_END;
+ else
+ return KEY_LINE_END;
+ case GDK_Page_Up:
+ return KEY_PAGE_UP;
+ case GDK_Page_Down:
+ return KEY_PAGE_DOWN;
+ case 'a':
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_SELECT_ALL;
+ return gdk_keyval_to_unicode(key->keyval);
+ case 'u':
+ if (key->state & GDK_CONTROL_MASK)
+ return KEY_CLEAR_SELECTION;
+ return gdk_keyval_to_unicode(key->keyval);
+ case GDK_Escape:
+ return KEY_ESCAPE;
+
+ /* Modifiers - do nothing for now */
+ case GDK_Shift_L:
+ case GDK_Shift_R:
+ case GDK_Control_L:
+ case GDK_Control_R:
+ case GDK_Caps_Lock:
+ case GDK_Shift_Lock:
+ case GDK_Meta_L:
+ case GDK_Meta_R:
+ case GDK_Alt_L:
+ case GDK_Alt_R:
+ case GDK_Super_L:
+ case GDK_Super_R:
+ case GDK_Hyper_L:
+ case GDK_Hyper_R: return 0;
+
+ default: return gdk_keyval_to_unicode(
+ key->keyval);
+ }
+}
diff --git a/gtk/gtk_gui.h b/gtk/gtk_gui.h
index eab25873b..8c9aa0afb 100644
--- a/gtk/gtk_gui.h
+++ b/gtk/gtk_gui.h
@@ -19,6 +19,7 @@
#ifndef GTK_GUI_H
#define GTK_GUI_H
+#include <inttypes.h>
#include <stdbool.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
@@ -37,5 +38,7 @@ extern GtkLabel *labelTooltip;
extern GtkDialog *wndOpenFile;
+uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *);
+
#endif /* GTK_GUI_H */
diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c
index 935b07992..700493b4c 100644
--- a/gtk/gtk_plotters.c
+++ b/gtk/gtk_plotters.c
@@ -119,7 +119,7 @@ bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
line_width = 1;
cairo_set_line_width(current_cr, line_width);
- cairo_rectangle(current_cr, x0, y0, width, height);
+ cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, width, height);
cairo_stroke(current_cr);
return true;
diff --git a/gtk/gtk_window.c b/gtk/gtk_window.c
index 57ac59ca5..7649418c4 100644
--- a/gtk/gtk_window.c
+++ b/gtk/gtk_window.c
@@ -38,7 +38,7 @@
struct gui_window *window_list = 0; /**< first entry in win list*/
int temp_open_background = -1;
-static uint32_t gdkkey_to_nskey(GdkEventKey *);
+
static void nsgtk_gui_window_attach_child(struct gui_window *parent,
struct gui_window *child);
/* Methods which apply only to a gui_window */
@@ -449,50 +449,11 @@ gboolean nsgtk_window_button_release_event(GtkWidget *widget,
return TRUE;
}
-uint32_t gdkkey_to_nskey(GdkEventKey *key)
-{
- /* this function will need to become much more complex to support
- * everything that the RISC OS version does. But this will do for
- * now. I hope.
- */
-
- switch (key->keyval)
- {
- case GDK_BackSpace: return KEY_DELETE_LEFT;
- case GDK_Delete: return KEY_DELETE_RIGHT;
- case GDK_Linefeed: return 13;
- case GDK_Return: return 10;
- case GDK_Left: return KEY_LEFT;
- case GDK_Right: return KEY_RIGHT;
- case GDK_Up: return KEY_UP;
- case GDK_Down: return KEY_DOWN;
-
- /* Modifiers - do nothing for now */
- case GDK_Shift_L:
- case GDK_Shift_R:
- case GDK_Control_L:
- case GDK_Control_R:
- case GDK_Caps_Lock:
- case GDK_Shift_Lock:
- case GDK_Meta_L:
- case GDK_Meta_R:
- case GDK_Alt_L:
- case GDK_Alt_R:
- case GDK_Super_L:
- case GDK_Super_R:
- case GDK_Hyper_L:
- case GDK_Hyper_R: return 0;
-
- default: return gdk_keyval_to_unicode(
- key->keyval);
- }
-}
-
gboolean nsgtk_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
struct gui_window *g = data;
- uint32_t nskey = gdkkey_to_nskey(event);
+ uint32_t nskey = gtk_gui_gdkkey_to_nskey(event);
if (browser_window_key_press(g->bw, nskey))
return TRUE;