]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/gtk2/gtk2_window.cpp
* Events are even better, not yet perfect !
[vlc] / modules / gui / skins / gtk2 / gtk2_window.cpp
index 49c36f1043f20226ee30488ad9150ba3fbb6b002..1bc862f272d8f3e1e8783e8bef0cc2cc85d69ddc 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_window.cpp: GTK2 implementation of the Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_window.cpp,v 1.10 2003/04/15 11:46:19 ipkiss Exp $
+ * $Id: gtk2_window.cpp,v 1.15 2003/04/15 20:33:58 karibu Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -64,7 +64,7 @@ SLWA SetLayeredWindowAttributes =
 //---------------------------------------------------------------------------
 GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
     bool visible, int transition, int normalalpha, int movealpha,
-    bool dragdrop )
+    bool dragdrop, string name )
     : Window( p_intf, x, y, visible, transition, normalalpha, movealpha,
               dragdrop )
 {
@@ -72,6 +72,8 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
     gWnd           = gwnd;
     gc = gdk_gc_new( gwnd );
 
+    Name        = name;
+
     LButtonDown = false;
     RButtonDown = false;
 /*
@@ -162,91 +164,78 @@ bool GTK2Window::ProcessOSEvent( Event *evt )
     unsigned int p1  = evt->GetParam1();
     int          p2  = evt->GetParam2();
 
-    fprintf( stderr, "salut %li\n", evt->GetMessage() );
-
     switch( msg )
     {
         case GDK_EXPOSE:
             RefreshFromImage( 0, 0, Width, Height );
             return true;
 
-
         case GDK_MOTION_NOTIFY:
-//            TRACKMOUSEEVENT TrackEvent;
-//            TrackEvent.cbSize      = sizeof( TRACKMOUSEEVENT );
-//            TrackEvent.dwFlags     = TME_LEAVE;
-//            TrackEvent.hwndTrack   = hWnd;
-//            TrackEvent.dwHoverTime = 1;
-//            TrackMouseEvent( &TrackEvent );
             if( LButtonDown )
-                MouseMove( ((GdkEventButton *)p2)->x_root, ((GdkEventButton *)p2)->y_root,
-                           1 );
+                MouseMove( (int)( (GdkEventButton *)p2 )->x,
+                           (int)( (GdkEventButton *)p2 )->y, 1 );
             else if( RButtonDown )
-                MouseMove( ((GdkEventButton *)p2)->x_root, ((GdkEventButton *)p2)->y_root,
-                           2 );
+                MouseMove( (int)( (GdkEventButton *)p2 )->x,
+                           (int)( (GdkEventButton *)p2 )->y, 2 );
             else
-                MouseMove( ((GdkEventButton *)p2)->x_root, ((GdkEventButton *)p2)->y_root,
-                           0 );
-
+                MouseMove( (int)( (GdkEventButton *)p2 )->x,
+                           (int)( (GdkEventButton *)p2 )->y, 0 );
+            gdk_window_get_pointer( gWnd, 0, 0, 0 );
             return true;
 
 
         case GDK_BUTTON_PRESS:
-            switch( ((GdkEventButton *)p2)->button )
+            switch( ( (GdkEventButton *)p2 )->button )
             {
                 case 1:
                     // Left button
                     LButtonDown = true;
-                    MouseDown( ((GdkEventButton *)p2)->x_root,
-                               ((GdkEventButton *)p2)->y_root, 1 );
+                    MouseDown( (int)( (GdkEventButton *)p2 )->x,
+                               (int)( (GdkEventButton *)p2 )->y, 1 );
                     break;
+
                 case 3:
                     // Right button
                     RButtonDown = true;
-                    MouseDown( ((GdkEventButton *)p2)->x_root,
-                               ((GdkEventButton *)p2)->y_root, 2 );
+                    MouseDown( (int)( (GdkEventButton *)p2 )->x,
+                               (int)( (GdkEventButton *)p2 )->y, 2 );
                     break;
+
                 default:
                     break;
             }
             return true;
 
         case GDK_BUTTON_RELEASE:
-            switch( ((GdkEventButton *)p2)->button )
+            switch( ( (GdkEventButton *)p2 )->button )
             {
                 case 1:
                     // Left button
                     LButtonDown = false;
-                    MouseUp( ((GdkEventButton *)p2)->x_root,
-                             ((GdkEventButton *)p2)->y_root, 1 );
+                    MouseUp( (int)( (GdkEventButton *)p2 )->x,
+                             (int)( (GdkEventButton *)p2 )->y, 1 );
                     break;
+
                 case 3:
                     // Right button
                     RButtonDown = false;
-                    MouseUp( ((GdkEventButton *)p2)->x_root,
-                             ((GdkEventButton *)p2)->y_root, 2 );
+                    MouseUp( (int)( (GdkEventButton *)p2 )->x,
+                             (int)( (GdkEventButton *)p2 )->y, 2 );
                     break;
+
                 default:
                     break;
             }
             return true;
 
-/*
-        case WM_RBUTTONDOWN:
-            MouseDown( LOWORD( p2 ), HIWORD( p2 ), 2 );
-            return true;
-
-        case WM_RBUTTONUP:
-            MouseUp( LOWORD( p2 ), HIWORD( p2 ), 2 );
+        case GDK_LEAVE_NOTIFY:
+            OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
             return true;
-
+/*
         case WM_LBUTTONDBLCLK:
             MouseDblClick( LOWORD( p2 ), HIWORD( p2 ), 1 );
             return true;
 
-        case WM_MOUSELEAVE:
-            OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
-            return true;
 */
         default:
             return false;
@@ -275,7 +264,6 @@ void GTK2Window::RefreshFromImage( int x, int y, int w, int h )
 
 */
 
- fprintf(stderr, "window %d %d %d %d\n", x, y, w, h);
     gdk_draw_drawable( gWnd, gc, (( GTK2Graphics* )Image )->GetImage(),
             x, y, x, y, w, h );
 }
@@ -290,7 +278,6 @@ void GTK2Window::WindowManualMove()
     p_intf->p_sys->p_theme->MoveSkinMagnet( this,
         WindowX + x - CursorX, WindowY + y - CursorY );
 
-    fprintf( stderr, "---------\n" );
 }
 //---------------------------------------------------------------------------
 void GTK2Window::WindowManualMoveInit()