summaryrefslogtreecommitdiff
path: root/atari/toolbar.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-04-24 20:32:53 +0000
committerOle Loots <ole@monochrom.net>2012-04-24 20:32:53 +0000
commite7104b44629aa7729c668a826d6e3969b1931593 (patch)
treef0949c531d0c9144273921292583fb7fb0e5961d /atari/toolbar.c
parent4204599fb949fa7eaea9b21213bc09861c7f14bf (diff)
downloadnetsurf-e7104b44629aa7729c668a826d6e3969b1931593.tar.gz
netsurf-e7104b44629aa7729c668a826d6e3969b1931593.tar.bz2
Implemented "paste clipboard" for toolbar URL textbox.
svn path=/trunk/netsurf/; revision=13887
Diffstat (limited to 'atari/toolbar.c')
-rwxr-xr-xatari/toolbar.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 520512757..f8bcef29d 100755
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -36,7 +36,8 @@
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
#include "desktop/plotters.h"
-#include "desktop/tree.h"
+#include "desktop/tree.h"
+#include "utils/utf8.h"
#include "atari/clipboard.h"
#include "atari/gui.h"
#include "atari/toolbar.h"
@@ -169,7 +170,7 @@ static nserror toolbar_icon_callback(hlcache_handle *handle,
static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
{
- OBJECT *tree;
+ OBJECT *tree=NULL;
LGRECT work,clip;
GRECT todo,crect;
struct s_tb_button *bt = (struct s_tb_button*)data;
@@ -177,8 +178,8 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
struct s_toolbar * tb = gw->root->toolbar;
short pxy[4];
- int bmpx, bmpy, bmpw, bmph;
- struct bitmap * icon;
+ int bmpx=0, bmpy=0, bmpw=0, bmph = 0;
+ struct bitmap * icon = NULL;
bool draw_bitmap = false;
mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
@@ -877,6 +878,25 @@ bool tb_url_input( struct gui_window * gw, short nkc )
free( text );
}
}
+ else if( ik == KEY_PASTE ){
+ char * clip = scrap_txt_read( &app );
+ if( clip != NULL ){
+ int clip_length = strlen( clip );
+ if ( clip_length > 0 ) {
+ char *utf8;
+ utf8_convert_ret res;
+ /* Clipboard is in local encoding so
+ * convert to UTF8 */
+ res = utf8_from_local_encoding( clip, clip_length, &utf8 );
+ if ( res == UTF8_CONVERT_OK ) {
+ tb_url_set( gw, utf8 );
+ free(utf8);
+ ret = true;
+ }
+ free( clip );
+ }
+ }
+ }
else if( ik == KEY_ESCAPE ) {
textarea_keypress( tb->url.textarea, KEY_SELECT_ALL );
textarea_keypress( tb->url.textarea, KEY_DELETE_LEFT );