LCOV - code coverage report
Current view: top level - vcl/inc/unx/gtk - gtkdata.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
      21             : #define INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
      22             : 
      23             : #include <prex.h>
      24             : #define GLIB_DISABLE_DEPRECATION_WARNINGS
      25             : #include <gdk/gdk.h>
      26             : #include <gdk/gdkx.h>
      27             : #include <gtk/gtk.h>
      28             : #include <postx.h>
      29             : 
      30             : #include <generic/gendata.hxx>
      31             : #include <unx/saldisp.hxx>
      32             : #include <unx/saldata.hxx>
      33             : #include <unx/gtk/gtksys.hxx>
      34             : #include <vcl/ptrstyle.hxx>
      35             : #include <osl/conditn.h>
      36             : #include "saltimer.hxx"
      37             : 
      38             : #include <list>
      39             : 
      40             : class GtkSalDisplay;
      41             : 
      42           0 : inline GdkWindow * widget_get_window(GtkWidget *widget)
      43             : {
      44             : #if GTK_CHECK_VERSION(3,0,0)
      45             :     return gtk_widget_get_window(widget);
      46             : #else
      47           0 :     return widget->window;
      48             : #endif
      49             : }
      50             : 
      51           0 : inline XLIB_Window widget_get_xid(GtkWidget *widget)
      52             : {
      53             : #if GTK_CHECK_VERSION(3,0,0)
      54             :     return GDK_WINDOW_XID(gtk_widget_get_window(widget));
      55             : #else
      56           0 :     return GDK_WINDOW_XWINDOW(widget->window);
      57             : #endif
      58             : }
      59             : 
      60           0 : inline void widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
      61             : {
      62             : #if GTK_CHECK_VERSION(3,0,0)
      63             :     return gtk_widget_set_can_focus(widget, can_focus);
      64             : #else
      65           0 :     if (can_focus)
      66           0 :         GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_FOCUS );
      67             :     else
      68           0 :         GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_FOCUS );
      69             : #endif
      70           0 : }
      71             : 
      72           0 : inline void widget_set_can_default(GtkWidget *widget, gboolean can_default)
      73             : {
      74             : #if GTK_CHECK_VERSION(3,0,0)
      75             :     return gtk_widget_set_can_default(widget, can_default);
      76             : #else
      77           0 :     if (can_default)
      78           0 :         GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_DEFAULT );
      79             :     else
      80           0 :         GTK_WIDGET_UNSET_FLAGS( widget, GTK_CAN_DEFAULT );
      81             : #endif
      82           0 : }
      83             : 
      84             : class GtkSalTimer : public SalTimer
      85             : {
      86             :     struct SalGtkTimeoutSource *m_pTimeout;
      87             : public:
      88             :     GtkSalTimer();
      89             :     virtual ~GtkSalTimer();
      90             :     virtual void Start( sal_uLong nMS ) SAL_OVERRIDE;
      91             :     virtual void Stop() SAL_OVERRIDE;
      92             :     bool         Expired();
      93             : 
      94             :     sal_uLong    m_nTimeoutMS;
      95             : };
      96             : 
      97             : class GtkData : public SalGenericData
      98             : {
      99             :     GSource *m_pUserEvent;
     100             :     oslMutex m_aDispatchMutex;
     101             :     oslCondition m_aDispatchCondition;
     102             : 
     103             : public:
     104             :     GtkData( SalInstance *pInstance );
     105             :     virtual ~GtkData();
     106             : 
     107             :     virtual void Init();
     108             :     virtual void Dispose() SAL_OVERRIDE;
     109             : 
     110             :     virtual void initNWF();
     111             :     virtual void deInitNWF();
     112             : 
     113             :     static gboolean userEventFn( gpointer data );
     114             : 
     115             :     virtual void PostUserEvent();
     116             :     void Yield( bool bWait, bool bHandleAllCurrentEvents );
     117             :     inline GdkDisplay *GetGdkDisplay();
     118             : 
     119             :     virtual void ErrorTrapPush() SAL_OVERRIDE;
     120             :     virtual bool ErrorTrapPop( bool bIgnoreError ) SAL_OVERRIDE;
     121             : };
     122             : 
     123             : class GtkSalFrame;
     124             : 
     125             : #if GTK_CHECK_VERSION(3,0,0)
     126             : class GtkSalDisplay : public SalGenericDisplay
     127             : #else
     128             : class GtkSalDisplay : public SalDisplay
     129             : #endif
     130             : {
     131             :     GtkSalSystem*                   m_pSys;
     132             :     GdkDisplay*                     m_pGdkDisplay;
     133             :     GdkCursor                      *m_aCursors[ POINTER_COUNT ];
     134             :     bool                            m_bStartupCompleted;
     135             :     bool                            m_bX11Display;
     136             : 
     137             :     GdkCursor* getFromXBM( const unsigned char *pBitmap, const unsigned char *pMask,
     138             :                            int nWidth, int nHeight, int nXHot, int nYHot );
     139             : public:
     140             :              GtkSalDisplay( GdkDisplay* pDisplay );
     141             :     virtual ~GtkSalDisplay();
     142             : 
     143           0 :     GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
     144           0 :     bool        IsX11Display() const { return m_bX11Display; }
     145             : 
     146           0 :     GtkSalSystem* getSystem() const { return m_pSys; }
     147             : 
     148             :     virtual void deregisterFrame( SalFrame* pFrame ) SAL_OVERRIDE;
     149             :     GdkCursor *getCursor( PointerStyle ePointerStyle );
     150             : #if GTK_CHECK_VERSION(3,0,0)
     151             :     virtual int CaptureMouse( SalFrame* pFrame );
     152             : #else
     153             :     virtual int CaptureMouse( SalFrame* pFrame ) SAL_OVERRIDE;
     154             : #endif
     155             : 
     156             :     int          GetDefaultScreen() { return m_pSys->GetDisplayBuiltInScreen(); }
     157           0 :     SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); }
     158             :     Size         GetScreenSize( int nDisplayScreen );
     159           0 :     int          GetXScreenCount() { return m_pSys->GetDisplayXScreenCount(); }
     160             : #if GTK_CHECK_VERSION(3,0,0)
     161             : //    int          GetScreenCount() { return m_pSys->GetDisplayScreenCount(); }
     162             : #else
     163             :     virtual ScreenData *initScreen( SalX11Screen nXScreen ) const SAL_OVERRIDE;
     164             : #endif
     165             : 
     166             :     GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
     167             :                                     GdkEvent* event );
     168           0 :     void startupNotificationCompleted() { m_bStartupCompleted = true; }
     169             : 
     170             :     void screenSizeChanged( GdkScreen* );
     171             :     void monitorsChanged( GdkScreen* );
     172             : 
     173             :     virtual void PostUserEvent() SAL_OVERRIDE;
     174             : 
     175             : #if GTK_CHECK_VERSION(3,0,0)
     176             :     guint32 GetLastUserEventTime( bool /* b */ ) { return GDK_CURRENT_TIME; } // horrible hack
     177             : #else
     178             :     virtual bool Dispatch( XEvent *pEvent ) SAL_OVERRIDE;
     179             : #endif
     180             : };
     181             : 
     182           0 : inline GtkData* GetGtkSalData()
     183             : {
     184           0 :     return (GtkData*)ImplGetSVData()->mpSalData;
     185             : }
     186           0 : inline GdkDisplay *GtkData::GetGdkDisplay()
     187             : {
     188           0 :     return GetGtkDisplay()->GetGdkDisplay();
     189             : }
     190             : 
     191             : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
     192             : 
     193             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10