LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/vcl/inc/unx/gtk - gtkdata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 24 0.0 %
Date: 2013-07-09 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 _VCL_GTKDATA_HXX
      21             : #define _VCL_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             :     ~GtkSalTimer();
      90             :     virtual void Start( sal_uLong nMS );
      91             :     virtual void Stop();
      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();
     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();
     120             :     virtual bool ErrorTrapPop( bool bIgnoreError );
     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 );
     149             :     GdkCursor *getCursor( PointerStyle ePointerStyle );
     150             :     virtual int CaptureMouse( SalFrame* pFrame );
     151             : 
     152             :     int          GetDefaultScreen() { return m_pSys->GetDisplayBuiltInScreen(); }
     153           0 :     SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); }
     154             :     Size         GetScreenSize( int nDisplayScreen );
     155           0 :     int          GetXScreenCount() { return m_pSys->GetDisplayXScreenCount(); }
     156             : #if GTK_CHECK_VERSION(3,0,0)
     157             : //    int          GetScreenCount() { return m_pSys->GetDisplayScreenCount(); }
     158             : #endif
     159             : #if !GTK_CHECK_VERSION(3,0,0)
     160             :     virtual ScreenData *initScreen( SalX11Screen nXScreen ) const;
     161             : #endif
     162             : 
     163             :     GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
     164             :                                     GdkEvent* event );
     165           0 :     void startupNotificationCompleted() { m_bStartupCompleted = true; }
     166             : 
     167             :     void screenSizeChanged( GdkScreen* );
     168             :     void monitorsChanged( GdkScreen* );
     169             : 
     170             :     virtual void PostUserEvent();
     171             : 
     172             : #if !GTK_CHECK_VERSION(3,0,0)
     173             :     virtual long Dispatch( XEvent *pEvent );
     174             : #else
     175             :     guint32 GetLastUserEventTime( bool /* b */ ) { return GDK_CURRENT_TIME; } // horrible hack
     176             : #endif
     177             : };
     178             : 
     179           0 : inline GtkData* GetGtkSalData()
     180             : {
     181           0 :     return (GtkData*)ImplGetSVData()->mpSalData;
     182             : }
     183           0 : inline GdkDisplay *GtkData::GetGdkDisplay()
     184             : {
     185           0 :     return GetGtkDisplay()->GetGdkDisplay();
     186             : }
     187             : #if !GTK_CHECK_VERSION(3,0,0)
     188             : #endif
     189             : 
     190             : #endif // _VCL_GTKDATA_HXX
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10