diff --git a/atari/misc.c b/atari/misc.c index e91c167de..06ef4e406 100755 --- a/atari/misc.c +++ b/atari/misc.c @@ -99,25 +99,44 @@ bool path_add_part(char *path, int length, const char *newpart) strncat(path, newpart, length); return true; -} +} + +/* + // TBD: make use of this function or remove it... +*/ +struct gui_window * find_gui_window( unsigned long handle, short mode ){ -struct gui_window * find_gui_window( WINDOW * win ){ - - struct gui_window * gw; - gw = window_list; - - if( win == NULL ) - return( NULL ); + struct gui_window * gw; + gw = window_list; + if( handle == 0 ){ + return( NULL ); + } + else if( mode == BY_WINDOM_HANDLE ){ + WINDOW * win = (WINDOW*) handle; while( gw != NULL) { if( gw->root->handle == win ) { - return( gw ); + return( gw ); } else - gw = gw->next; - } + gw = gw->next; + } + } + else if( mode == BY_GEM_HANDLE ){ + short ghandle = (short)handle; + while( gw != NULL) { + if( gw->root->handle != NULL + && gw->root->handle->handle == ghandle ) { + 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 2117f8b50..5ec6ad8b2 100755 --- a/atari/misc.h +++ b/atari/misc.h @@ -21,6 +21,7 @@ #include "cflib.h" #include "desktop/textinput.h" +#include "atari/gui.h" #define SBUF8_TO_LBUF8(sbuf,lbuf)\ lbuf[0] = (long)sbuf[0];\ @@ -32,8 +33,12 @@ lbuf[6] = (long)sbuf[6];\ lbuf[7] = (long)sbuf[7]; + +/* Modes for find_gui_window: */ +#define BY_WINDOM_HANDLE 0x0 +#define BY_GEM_HANDLE 0x1 -struct gui_window * find_gui_window( WINDOW * win ); +struct gui_window * find_gui_window( unsigned long, short mode ); struct gui_window * find_cmp_window( COMPONENT * c ); OBJECT *get_tree( int idx ); char *get_rsc_string( int idx );