summaryrefslogtreecommitdiff
path: root/atari
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2011-09-09 22:18:49 +0000
committerOle Loots <ole@monochrom.net>2011-09-09 22:18:49 +0000
commitcbeffd4c5f4ac2ecbb2cfc97a705441a20ec8f23 (patch)
treeff42047c0a624fd83d2463b565da490162b9e996 /atari
parent6cde3888afdf128bf790eef8fc7891d0e5c41d03 (diff)
downloadnetsurf-cbeffd4c5f4ac2ecbb2cfc97a705441a20ec8f23.tar.gz
netsurf-cbeffd4c5f4ac2ecbb2cfc97a705441a20ec8f23.tar.bz2
Keep Mouse tracking limited to input_window.
svn path=/trunk/netsurf/; revision=12783
Diffstat (limited to 'atari')
-rwxr-xr-xatari/browser.c14
-rwxr-xr-xatari/browser_win.c7
-rwxr-xr-xatari/gui.c21
-rwxr-xr-xatari/misc.c17
-rwxr-xr-xatari/misc.h1
5 files changed, 53 insertions, 7 deletions
diff --git a/atari/browser.c b/atari/browser.c
index 6c8f6429e..c193f2ddb 100755
--- a/atari/browser.c
+++ b/atari/browser.c
@@ -242,6 +242,10 @@ static void __CDECL browser_evnt_arrowed( WINDOW *win, short buff[8], void * dat
int value = BROWSER_SCROLL_SVAL;
struct gui_window * gw = data;
LGRECT cwork;
+
+ if( input_window == NULL || input_window != gw ) {
+ return;
+ }
browser_get_rect( gw, BR_CONTENT, &cwork );
switch( buff[4] ) {
@@ -265,11 +269,15 @@ void __CDECL browser_evnt_slider( WINDOW *win, short buff[8], void * data)
{
int dx = buff[4];
int dy = buff[5];
- struct gui_window * gw = data;
GRECT work, screen;
+ struct gui_window * gw = data;
if (!dx && !dy) return;
+ if( input_window == NULL || input_window != gw ) {
+ return;
+ }
+
/* update the sliders _before_ we call redraw (which might depend on the slider possitions) */
mt_WindSlider( &app, win, (dx?HSLIDER:0) | (dy?VSLIDER:0) );
@@ -291,7 +299,9 @@ static void __CDECL browser_evnt_mbutton( WINDOW * c, short buff[8], void * data
uint32_t tnow = clock()*1000 / CLOCKS_PER_SEC;
LGRECT cwork;
struct gui_window * gw = data;
- input_window = gw;
+ if( input_window != gw ) {
+ return;
+ }
window_set_focus( gw, BROWSER, (void*)gw->browser );
browser_get_rect( gw, BR_CONTENT, &cwork );
mx = evnt.mx - cwork.g_x;
diff --git a/atari/browser_win.c b/atari/browser_win.c
index 572e3be5c..427ddedad 100755
--- a/atari/browser_win.c
+++ b/atari/browser_win.c
@@ -105,7 +105,7 @@ static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data
}
/*
- this gets called at end of gui poll to track the mouse state and
+ track the mouse state and
finally checks for released buttons.
*/
static void window_track_mouse_state( LGRECT * bwrect, bool within, short mx, short my, short mbut, short mkstate ){
@@ -150,7 +150,6 @@ static void window_track_mouse_state( LGRECT * bwrect, bool within, short mx, sh
if( !(mbut & i) ) {
if( mouse_hold_start[i-1] > 0 ) {
mouse_hold_start[i-1] = 0;
- /* TODO: not just use the input window browser, find the right one by component! */
if( i==1 ) {
LOG(("Drag for %d ended", i));
bmstate &= ~( BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_1 ) ;
@@ -192,6 +191,10 @@ static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data)
if( gw == NULL)
return;
+ if( gw != input_window ){
+ return;
+ }
+
graf_mkstate(&mx, &my, &mbut, &mkstate);
browser_get_rect( gw, BR_CONTENT, &bwbox );
diff --git a/atari/gui.c b/atari/gui.c
index cbcedac7d..da5953997 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -136,11 +136,27 @@ void gui_poll(bool active)
/* this can be improved a lot under XaAES - there is an event for mouse move */
if( mx >= winloc[0] && mx <= winloc[0] + winloc[2] &&
my >= winloc[1] && my <= winloc[1] + winloc[3] ){
+ /* Mouse is within the top window area */
evnt.m1_flag = MO_LEAVE;
evnt.m1_w = evnt.m1_h = 1;
evnt.m1_x = mx;
evnt.m1_y = my;
} else {
+ /* Mouse is outside of top window area. */
+ if( evnt.m1_flag == MO_LEAVE ) {
+ /* Previous move was inside the top window area */
+ struct gui_window * gw = input_window;
+ if(gw != NULL && gw->browser != NULL && gw->browser->bw != NULL ){
+ /* reset mouse state */
+ /* you could also track further, without reset, but */
+ /* when the mouse moves into native scroller area, the mouse is */
+ /* the native scroll bar code gets in between.. */
+ mouse_hold_start[0] = 0;
+ mouse_hold_start[1] = 0;
+ bmstate = 0;
+ browser_window_mouse_track( gw->browser->bw, bmstate, mx, my );
+ }
+ }
evnt.m1_flag = MO_ENTER;
evnt.m1_w = winloc[2];
evnt.m1_h = winloc[3];
@@ -149,8 +165,7 @@ void gui_poll(bool active)
}
}
- /*printf("time: %d, active: %d, pending: %d\n", evnt.timer,
- active, browser_reformat_pending );*/
+ /*printf("time: %d, active: %d\n", evnt.timer, active );*/
if( active ) {
if( clock() >= next_poll ) {
evnt.timer = 0;
@@ -160,7 +175,7 @@ void gui_poll(bool active)
}
} else {
flags |= MU_TIMER;
- EvntWindom( flags );
+ EvntWindom( flags );
}
struct gui_window * g;
diff --git a/atari/misc.c b/atari/misc.c
index fc1d6a661..18130e3b9 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -100,6 +100,23 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
+struct gui_window * find_gui_window( WINDOW * win ){
+
+ struct gui_window * gw;
+ gw = window_list;
+
+ if( win == NULL )
+ return( NULL );
+
+ while( gw != NULL) {
+ if( gw->root->handle == win ) {
+ return( gw );
+ }
+ else
+ gw = gw->next;
+ }
+ return( NULL );
+}
struct gui_window * find_cmp_window( COMPONENT * c )
{
diff --git a/atari/misc.h b/atari/misc.h
index 216ab17b0..2642b395f 100755
--- a/atari/misc.h
+++ b/atari/misc.h
@@ -30,6 +30,7 @@
lbuf[7] = (long)sbuf[7];
+struct gui_window * find_gui_window( WINDOW * win );
struct gui_window * find_cmp_window( COMPONENT * c );
OBJECT *get_tree( int idx );
char *get_rsc_string( int idx );