Mercurial > mplayer.hg
changeset 35675:9e2183017f1f
Move wgIsRect from ws.h to gui.h.
It's not window system specific.
Additionally, rename it isInside.
author | ib |
---|---|
date | Thu, 17 Jan 2013 17:11:46 +0000 |
parents | 5c2f331d306a |
children | b0ad675bd3b7 |
files | gui/app/gui.h gui/ui/main.c gui/ui/menu.c gui/ui/playbar.c gui/wm/ws.h |
diffstat | 5 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 */
--- 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 )
--- 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 ) )
--- 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 )
--- 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 */