# HG changeset patch # User ib # Date 1358442706 0 # Node ID 9e2183017f1f046bbf6ee0bf2f39030f5e15c4a3 # Parent 5c2f331d306a57616d4f676d0ac6fe06eb1c603b Move wgIsRect from ws.h to gui.h. It's not window system specific. Additionally, rename it isInside. diff -r 5c2f331d306a -r 9e2183017f1f gui/app/gui.h --- a/gui/app/gui.h Thu Jan 17 16:53:15 2013 +0000 +++ b/gui/app/gui.h Thu Jan 17 17:11:46 2013 +0000 @@ -38,4 +38,7 @@ /// StreamTypes that are permitted in a playlist #define isPlaylistStreamtype (guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM) +/// check whether x/y is inside the rectangle given by top x/y and bottom x/y +#define isInside(x, y, tx, ty, bx, by) ((x) > (tx) && (y) > (ty) && (x) < (bx) && (y) < (by)) + #endif /* MPLAYER_GUI_GUI_H */ diff -r 5c2f331d306a -r 9e2183017f1f gui/ui/main.c --- a/gui/ui/main.c Thu Jan 17 16:53:15 2013 +0000 +++ b/gui/ui/main.c Thu Jan 17 17:11:46 2013 +0000 @@ -431,7 +431,7 @@ for ( i=0;i <= guiApp.IndexOfMainItems;i++ ) if ( ( guiApp.mainItems[i].pressed != btnDisabled )&& - ( wgIsRect( X,Y,guiApp.mainItems[i].x,guiApp.mainItems[i].y,guiApp.mainItems[i].x+guiApp.mainItems[i].width,guiApp.mainItems[i].y+guiApp.mainItems[i].height ) ) ) + ( isInside( X,Y,guiApp.mainItems[i].x,guiApp.mainItems[i].y,guiApp.mainItems[i].x+guiApp.mainItems[i].width,guiApp.mainItems[i].y+guiApp.mainItems[i].height ) ) ) { currentselected=i; break; } switch ( Button ) diff -r 5c2f331d306a -r 9e2183017f1f gui/ui/menu.c --- a/gui/ui/menu.c Thu Jan 17 16:53:15 2013 +0000 +++ b/gui/ui/menu.c Thu Jan 17 17:11:46 2013 +0000 @@ -87,7 +87,7 @@ for( i=0;i<=guiApp.IndexOfMenuItems;i++ ) { - if ( wgIsRect( x,y, + if ( isInside( x,y, guiApp.menuItems[i].x,guiApp.menuItems[i].y, guiApp.menuItems[i].x+guiApp.menuItems[i].width,guiApp.menuItems[i].y+guiApp.menuItems[i].height ) ) { menuItem=i; break; } } @@ -134,7 +134,7 @@ // printf( "---------> %d %d,%d\n",i,x,y ); // printf( "--------> mi: %d,%d %dx%d\n",guiApp.menuItems[i].x,guiApp.menuItems[i].y,guiApp.menuItems[i].width,guiApp.menuItems[i].height ); - if ( wgIsRect( x,y, + if ( isInside( x,y, guiApp.menuItems[i].x,guiApp.menuItems[i].y, guiApp.menuItems[i].x+guiApp.menuItems[i].width, guiApp.menuItems[i].y+guiApp.menuItems[i].height ) ) diff -r 5c2f331d306a -r 9e2183017f1f gui/ui/playbar.c --- a/gui/ui/playbar.c Thu Jan 17 16:53:15 2013 +0000 +++ b/gui/ui/playbar.c Thu Jan 17 17:11:46 2013 +0000 @@ -127,7 +127,7 @@ for ( i=0;i <= guiApp.IndexOfPlaybarItems;i++ ) if ( ( guiApp.playbarItems[i].pressed != btnDisabled )&& - ( wgIsRect( X,Y,guiApp.playbarItems[i].x,guiApp.playbarItems[i].y,guiApp.playbarItems[i].x+guiApp.playbarItems[i].width,guiApp.playbarItems[i].y+guiApp.playbarItems[i].height ) ) ) + ( isInside( X,Y,guiApp.playbarItems[i].x,guiApp.playbarItems[i].y,guiApp.playbarItems[i].x+guiApp.playbarItems[i].width,guiApp.playbarItems[i].y+guiApp.playbarItems[i].height ) ) ) { currentselected=i; break; } switch ( Button ) diff -r 5c2f331d306a -r 9e2183017f1f gui/wm/ws.h --- a/gui/wm/ws.h Thu Jan 17 16:53:15 2013 +0000 +++ b/gui/wm/ws.h Thu Jan 17 17:11:46 2013 +0000 @@ -213,6 +213,4 @@ void wsResizeImage(wsWindow *win, int Width, int Height); void wsDestroyImage(wsWindow *win); -#define wgIsRect(X, Y, tX, tY, bX, bY) (((X) > (tX)) && ((Y) > (tY)) && ((X) < (bX)) && ((Y) < (bY))) - #endif /* MPLAYER_GUI_WS_H */