]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/directx/events.c: added an "Always on top" entry
authorOlivier Teulière <ipkiss@videolan.org>
Tue, 1 Oct 2002 20:43:35 +0000 (20:43 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Tue, 1 Oct 2002 20:43:35 +0000 (20:43 +0000)
  in the system menu.

modules/video_output/directx/events.c
modules/video_output/directx/vout.h

index 6e55e719ea3daea0f9230f6991e098f4173a2490..6462ceda552396ddbfc04ee7c584f9545954b43f 100644 (file)
@@ -2,7 +2,7 @@
  * events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: events.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: events.c,v 1.2 2002/10/01 20:43:35 ipkiss Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -244,6 +244,7 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
     RECT       rect_window;
     COLORREF   colorkey; 
     HDC        hdc;
+    HMENU      hMenu;
     HICON      vlc_icon = NULL;
     char       vlc_path[_MAX_PATH+1];
 
@@ -366,6 +367,11 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
      * We need to use SetWindowLongPtr when it is available in mingw */
     SetWindowLong( p_vout->p_sys->hwnd, GWL_USERDATA, (LONG)p_vout );
 
+    /* append a "Always On Top" entry in the system menu */
+    hMenu = GetSystemMenu( p_vout->p_sys->hwnd, FALSE );
+    AppendMenu( hMenu, MF_SEPARATOR, 0, "" );
+    AppendMenu( hMenu, MF_STRING | MF_UNCHECKED, IDM_TOGGLE_ON_TOP, "Always on &Top");
+
     /* now display the window */
     ShowWindow(p_vout->p_sys->hwnd, SW_SHOW);
 
@@ -545,8 +551,34 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
         {
             case SC_SCREENSAVE:                     /* catch the screensaver */
             case SC_MONITORPOWER:              /* catch the monitor turn-off */
-            msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND" );
-            return 0;                      /* this stops them from happening */
+                msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND" );
+                return 0;                  /* this stops them from happening */
+            case IDM_TOGGLE_ON_TOP:            /* toggle the "on top" status */
+            {
+                HMENU hMenu = GetSystemMenu( hwnd , FALSE );
+
+                msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND: IDM_TOGGLE_ON_TOP");
+
+                // Check if the window is already on top
+                if( GetWindowLong( hwnd, GWL_EXSTYLE ) & WS_EX_TOPMOST )
+                {
+                    CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
+                                   MF_BYCOMMAND | MFS_UNCHECKED );
+                    SetWindowPos( hwnd, HWND_NOTOPMOST,
+                                  0, 0, 0, 0,
+                                  SWP_NOSIZE | SWP_NOMOVE );
+                }
+                else
+                {
+                    CheckMenuItem( hMenu, IDM_TOGGLE_ON_TOP,
+                                   MF_BYCOMMAND | MFS_CHECKED );
+                    SetWindowPos( hwnd, HWND_TOPMOST,
+                                  0, 0, 0, 0,
+                                  SWP_NOSIZE | SWP_NOMOVE );
+                }
+                return 0;
+                break;
+            }
         }
         break;
 
index 6cfaed8e1833e8275850b54eb75c8269cb8e6d48..0dc675a6fe658058fa8c8f709f538942f6db88ce 100644 (file)
@@ -2,7 +2,7 @@
  * vout.h: Windows DirectX video output header file
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout.h,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: vout.h,v 1.2 2002/10/01 20:43:35 ipkiss Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -110,3 +110,4 @@ void DirectXUpdateOverlay( vout_thread_t *p_vout );
  * Constants
  *****************************************************************************/
 #define WM_VLC_HIDE_MOUSE WM_APP
+#define IDM_TOGGLE_ON_TOP WM_USER + 1