Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1976

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/76/1976/1

Drag main window by using the menubar on Gtk

Change-Id: I04a5864120f44cf987312bb41b9cbb1f9c71b248
---
M vcl/headless/svpframe.cxx
M vcl/inc/headless/svpframe.hxx
M vcl/inc/salframe.hxx
M vcl/inc/unx/gtk/gtkframe.hxx
M vcl/inc/unx/salframe.h
M vcl/inc/vcl/window.hxx
M vcl/inc/win/salframe.h
M vcl/source/window/menu.cxx
M vcl/source/window/window.cxx
M vcl/unx/generic/window/salframe.cxx
M vcl/unx/gtk/window/gtkframe.cxx
M vcl/unx/kde4/KDESalFrame.cxx
M vcl/unx/kde4/KDESalFrame.hxx
M vcl/win/source/window/salframe.cxx
14 files changed, 67 insertions(+), 3 deletions(-)



diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 0d4e466..c9dc95c 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -470,4 +470,8 @@
 {
 }
 
+void SvpSalFrame::StartDragFrame (long /*x*/, long /*y*/, sal_uInt16 /*button*/, sal_uLong 
/*nTime*/)
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index c48d602..c96116c 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -127,7 +127,7 @@
     bool IsVisible() { return m_bVisible; }
 
     static SvpSalFrame*         GetFocusFrame() { return s_pFocusFrame; }
-
+    void StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime) ;
 };
 #endif // _SVP_SVPFRAME_HXX
 
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 63096e0..fbbd9a2 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -22,6 +22,7 @@
 
 #include <tools/solar.h>
 #include <vcl/dllapi.h>
+#include <vcl/event.hxx>
 
 #ifdef __cplusplus
 
@@ -248,6 +249,9 @@
     // done setting up the clipregion
     virtual void                    EndSetClipRegion() = 0;
 
+    // start dragging the frame on the desktop
+    virtual void StartDragFrame     (long x, long y, sal_uInt16 button, sal_uLong nTime) = 0;
+
     // Callbacks (indepent part in vcl/source/window/winproc.cxx)
     // for default message handling return 0
     void                        SetCallback( Window* pWindow, SALFRAMEPROC pProc )
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index a33a558..8f454df 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -328,6 +328,7 @@
     SalX11Screen getXScreenNumber() const { return m_nXScreen; }
     int          GetDisplayScreen() const { return maGeometry.nDisplayScreenNumber; }
     void updateScreenNumber();
+    void StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime);
 
 #if GTK_CHECK_VERSION(3,0,0)
     // only for gtk3 ...
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index c6a8cc3..541d75e 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -251,6 +251,8 @@
     virtual void                SetScreenNumber( unsigned int );
     virtual void                SetApplicationID( const rtl::OUString &rWMClass );
 
+    void StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime) ;
+
     // shaped system windows
     // set clip region to none (-> rectangular windows, normal state)
     virtual void                    ResetClipRegion();
@@ -265,6 +267,7 @@
 
     /// @internal
     void setPendingSizeEvent();
+
 };
 
 #ifdef _SV_SALDISP_HXX
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index ccd599a..811a8ee 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -980,6 +980,8 @@
     void                StartAutoScroll( sal_uInt16 nFlags );
     void                EndAutoScroll();
 
+    void                StartDragWindow( const MouseEvent& rMouseEvent );
+
     sal_Bool                HandleScrollCommand( const CommandEvent& rCmd,
                                              ScrollBar* pHScrl = NULL,
                                              ScrollBar* pVScrl = NULL );
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 54e10bd..d48563d 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -133,6 +133,7 @@
     virtual void                BeginSetClipRegion( sal_uIntPtr nRects );
     virtual void                UnionClipRegion( long nX, long nY, long nWidth, long nHeight );
     virtual void                EndSetClipRegion();
+    virtual void StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime) ;
 };
 
 void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a163041..1a4c45e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -5395,11 +5395,15 @@
     {
         ChangeHighlightItem( nEntry, sal_False );
     }
-    else
+    else if (pActivePopup)
     {
         KillActivePopup();
         ChangeHighlightItem( ITEMPOS_INVALID, sal_False );
     }
+    else
+    {
+        StartDragWindow(rMEvt);
+    }
 }
 
 void MenuBarWindow::MouseButtonUp( const MouseEvent& )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6767fde..8868628 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -9663,6 +9663,17 @@
     mnDPIY = nOldDPIY;
 }
 
+void Window::StartDragWindow( const MouseEvent& rMouseEvent )
+{
+    SalFrame* frame = ImplGetFrame();
+    if (frame)
+    {
+        long x = rMouseEvent.GetPosPixel().X();
+        long y = rMouseEvent.GetPosPixel().Y();
+        frame->StartDragFrame(x, y, rMouseEvent.GetButtons(), 
mpWindowImpl->mpFrameData->mnMouseDownTime);
+    }
+}
+
 void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ )
 {
     // FIXME: scaling: currently this is for pixel copying only
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index a30c32f..4413ba1 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -4219,4 +4219,9 @@
 
 }
 
+void X11SalFrame::StartDragFrame ( long /*x*/, long /*y*/, sal_uInt16 /*button*/, sal_uLong 
/*nTime*/)
+{
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 6343f5b..6bc80e3 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -125,7 +125,7 @@
 
 static sal_uInt16 GetMouseModCode( guint state )
 {
-    sal_uInt16 nCode = GetKeyModCode( state );
+    sal_uInt16 nCode = GetKeyModCode(state);
     if( (state & GDK_BUTTON1_MASK) )
         nCode |= MOUSE_LEFT;
     if( (state & GDK_BUTTON2_MASK) )
@@ -134,6 +134,18 @@
         nCode |= MOUSE_RIGHT;
 
     return nCode;
+}
+
+static gint GetGdkMouseButton( sal_uInt16 code )
+{
+    gint gdkMouseCode = 0;
+    if (code & MOUSE_LEFT)
+        gdkMouseCode |= GDK_BUTTON1_MASK;
+    if (code & MOUSE_MIDDLE)
+        gdkMouseCode |= GDK_BUTTON2_MASK;
+    if (code & MOUSE_RIGHT)
+        gdkMouseCode |= GDK_BUTTON3_MASK;
+    return gdkMouseCode;
 }
 
 static sal_uInt16 GetKeyCode( guint keyval )
@@ -4271,4 +4283,12 @@
     return Size( aRect.GetWidth(), aRect.GetHeight() );
 }
 
+void GtkSalFrame::StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime)
+{
+    if( ! isChild() && m_pWindow)
+    {
+        gtk_window_begin_move_drag( GTK_WINDOW(m_pWindow), GetGdkMouseButton(button), x + 
maGeometry.nX, y + maGeometry.nY, nTime);
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 6f3fe53..7d128c6 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -387,4 +387,9 @@
     return NULL;
 }
 
+void KDESalFrame::StartDragFrame ( long /*x*/, long /*y*/, sal_uInt16 /*button*/, sal_uLong 
/*nTime*/)
+{
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx
index 739aacd..832c786 100644
--- a/vcl/unx/kde4/KDESalFrame.hxx
+++ b/vcl/unx/kde4/KDESalFrame.hxx
@@ -47,6 +47,7 @@
         virtual void updateGraphics( bool bClear );
         virtual void UpdateSettings( AllSettings& rSettings );
         virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate );
+        virtual void StartDragFrame (long x, long y, sal_uInt16 button, sal_uLong nTime) ;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 235436f..0c64f7b 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -6126,6 +6126,9 @@
         return TRUE;
 }
 
+void WinSalFrameStartDragFrame (long /*x*/, long /*y*/, sal_uInt16 /*button*/, sal_uLong 
/*nTime*/) {
+
+}
 // -----------------------------------------------------------------------
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

-- 
To view, visit https://gerrit.libreoffice.org/1976
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04a5864120f44cf987312bb41b9cbb1f9c71b248
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Arnaud Versini <arnaud.versini@gmail.com>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.