diff options
author | Ole Loots <ole@monochrom.net> | 2011-12-12 19:39:53 +0000 |
---|---|---|
committer | Ole Loots <ole@monochrom.net> | 2011-12-12 19:39:53 +0000 |
commit | 004398f65f7b9944ae3292e7786eacda9fc1877d (patch) | |
tree | 7e58c624e1865a68066e76edc3a88d1f009eb4d4 /atari | |
parent | a6643b7cd5ee0d3137c94d9a09ac1661fa98e659 (diff) | |
download | netsurf-004398f65f7b9944ae3292e7786eacda9fc1877d.tar.gz netsurf-004398f65f7b9944ae3292e7786eacda9fc1877d.tar.bz2 |
Moved to mouse move handler to global events, and handle different window types.
svn path=/trunk/netsurf/; revision=13269
Diffstat (limited to 'atari')
-rwxr-xr-x | atari/browser_win.c | 50 | ||||
-rwxr-xr-x | atari/global_evnt.c | 76 |
2 files changed, 70 insertions, 56 deletions
diff --git a/atari/browser_win.c b/atari/browser_win.c index 4a5c4e2cd..3b201a77f 100755 --- a/atari/browser_win.c +++ b/atari/browser_win.c @@ -78,7 +78,6 @@ static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * da static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data ) ;
static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data );
-static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data);
static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data); static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data ); static void __CDECL evnt_window_uniconify( WINDOW *win, short buff[8], void * data ); @@ -170,7 +169,6 @@ int window_create( struct gui_window * gw, EvntDataAdd( gw->root->handle, WM_ICONIFY, evnt_window_iconify, gw, EV_BOT); EvntDataAdd( gw->root->handle, WM_UNICONIFY, evnt_window_uniconify, gw, EV_BOT);
EvntDataAttach( gw->root->handle, WM_ICONDRAW, evnt_window_icondraw, gw);
- EvntDataAttach( gw->root->handle, WM_XM1, evnt_window_m1, gw ); EvntDataAttach( gw->root->handle, WM_SLIDEXY, evnt_window_slider, gw ); /* TODO: check if window is openend as "foreground" window... */
@@ -426,54 +424,6 @@ error: ddclose( dd_hdl);
} -
-static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data)
-{
- struct gui_window * gw = input_window;
- static bool prev_url = false; - static short prev_x=0; - static short prev_y=0;
- bool within = false;
- LGRECT urlbox, bwbox, sbbox; - int nx, ny; -
- if( gw == NULL)
- return; - - if( prev_x == evnt.mx && prev_y == evnt.my ){ - return; - }
- browser_get_rect( gw, BR_CONTENT, &bwbox );
-
- if( evnt.mx > bwbox.g_x && evnt.mx < bwbox.g_x + bwbox.g_w &&
- evnt.my > bwbox.g_y && evnt.my < bwbox.g_y + bwbox.g_h ){
- within = true; - browser_window_mouse_track(
- input_window->browser->bw,
- 0,
- evnt.mx - bwbox.g_x + gw->browser->scroll.current.x,
- evnt.my - bwbox.g_y + gw->browser->scroll.current.y
- );
- } - - if( gw->root->toolbar && within == false ) { - mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH, &urlbox);
- if( (evnt.mx > urlbox.g_x && evnt.mx < urlbox.g_x + urlbox.g_w ) &&
- (evnt.my > urlbox.g_y && evnt.my < + urlbox.g_y + urlbox.g_h )) {
- gem_set_cursor( &gem_cursors.ibeam );
- prev_url = true;
- } else { - if( prev_url ) {
- gem_set_cursor( &gem_cursors.arrow );
- prev_url = false;
- } - }
- } - - prev_x = evnt.mx; - prev_y = evnt.my;
-}
-
static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data )
{
LOG(("%s\n", __FUNCTION__ ));
diff --git a/atari/global_evnt.c b/atari/global_evnt.c index 4cfadf98a..ccb4b39c4 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -47,7 +47,8 @@ #include "atari/res/netsurf.rsh"
#include "atari/search.h"
#include "atari/options.h" -#include "atari/findfile.h"
+#include "atari/findfile.h" +#include "atari/settings.h"
#include "cflib.h"
extern const char * cfg_homepage_url;
@@ -73,8 +74,9 @@ static char * menu_titles[NUM_MENU_TITLES] = {NULL}; /* Global event handlers: */
static void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data);
+static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] ); +static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] );
+static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8],void * data);
/* Menu event handlers: */
static void __CDECL menu_about(WINDOW *win, int item, int title, void *data);
@@ -222,8 +224,10 @@ static void __CDECL menu_find(WINDOW *win, int item, int title, void *data) }
static void __CDECL menu_choices(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
+{ + static WINDOW * settings_dlg = NULL;
+ LOG(("%s", __FUNCTION__)); + settings_dlg = open_settings();
}
static void __CDECL menu_stop(WINDOW *win, int item, int title, void *data)
@@ -376,6 +380,65 @@ void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] ) int i = 0;
LOG((""));
netsurf_quit = true;
+} + +
+static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] )
+{
+ struct gui_window * gw = input_window;
+ static bool prev_url = false; + static short prev_x=0; + static short prev_y=0;
+ bool within = false;
+ LGRECT urlbox, bwbox, sbbox; + int nx, ny; +
+ if( gw == NULL)
+ return; + + if( prev_x == evnt.mx && prev_y == evnt.my ){ + return; + } + + short ghandle = wind_find( evnt.mx, evnt.my ); + if( input_window->root->handle->handle == ghandle ){ + + // The window found at x,y is an gui_window + // and it's the input window. +
+ browser_get_rect( gw, BR_CONTENT, &bwbox );
+
+ if( evnt.mx > bwbox.g_x && evnt.mx < bwbox.g_x + bwbox.g_w &&
+ evnt.my > bwbox.g_y && evnt.my < bwbox.g_y + bwbox.g_h ){
+ within = true; + browser_window_mouse_track(
+ input_window->browser->bw,
+ 0,
+ evnt.mx - bwbox.g_x + gw->browser->scroll.current.x,
+ evnt.my - bwbox.g_y + gw->browser->scroll.current.y
+ );
+ } + + if( gw->root->toolbar && within == false ) { + mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH, &urlbox);
+ if( (evnt.mx > urlbox.g_x && evnt.mx < urlbox.g_x + urlbox.g_w ) &&
+ (evnt.my > urlbox.g_y && evnt.my < + urlbox.g_y + urlbox.g_h )) {
+ gem_set_cursor( &gem_cursors.ibeam );
+ prev_url = true;
+ } else { + if( prev_url ) {
+ gem_set_cursor( &gem_cursors.arrow );
+ prev_url = false;
+ } + }
+ } + } else { + gem_set_cursor( &gem_cursors.arrow ); + prev_url = false; + } + + prev_x = evnt.mx; + prev_y = evnt.my;
}
void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data)
@@ -604,7 +667,8 @@ void bind_global_events( void ) memset( (void*)&evnt_data, 0, sizeof(struct s_evnt_data) );
EvntDataAttach( NULL, WM_XKEYBD, global_evnt_keybd, (void*)&evnt_data );
EvntAttach( NULL, AP_TERM, global_evnt_apterm );
- EvntAttach( NULL, MN_SELECTED, global_evnt_menu );
+ EvntAttach( NULL, MN_SELECTED, global_evnt_menu ); + EvntAttach( NULL, WM_XM1, global_evnt_m1 );
set_menu_title( MAINMENU_T_FILE, "Page");
set_menu_title( MAINMENU_T_EDIT, "Edit" );
|