aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/widgets/mwindow_p.h
blob: c785d2be45e3a31f83abb18f2fdfd0c333e04301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#ifndef MWINDOW_P_H
#define MWINDOW_P_H

#include <QTimeLine>
#include <QElapsedTimer>
#include <QTimer>
#include "mwindow.h"

#include <mscenemanager.h>

#ifdef HAVE_GCONF
#include <mgconfitem.h>
#endif


class MScene;
class MOnDisplayChangeEvent;
class MStatusBar;
class QGLWidget;
class QGLContext;

class MWindowPrivate
{
public:

    MWindowPrivate();
    virtual ~MWindowPrivate();

    void handleApplicationLayoutDirectionChangeEvent(QGraphicsItem *item);
    void handleLanguageChangeEvent(QGraphicsItem *item);
    void handleWindowStateChangeEvent(QWindowStateChangeEvent *event);
    void handleCloseEvent(QCloseEvent *event);
    M::Orientation orientation(M::OrientationAngle angle) const;
    bool debugShortcutModifiersPresent(Qt::KeyboardModifiers modifiers) const;
    void setVisible(bool visible);
    void _q_enablePaintUpdates();
    MSceneManager::TransitionMode orientationChangeTransitionMode();
    void ensureOrientationAngleIsUpToDateBeforeShowing();

#ifdef Q_WS_X11
    void appendVisibilityChangeMask();
    void applyStartupWindowBackground();
    void setX11Property(const char *propertyName, qreal value);
    qreal getX11Property(const char *propertyName) const;
    void setX11PrestartProperty(bool set);
    void setX11OrientationAngleProperty(M::OrientationAngle angle);
#endif

    void _q_onPixmapRequestsFinished();

    QGLWidget *glWidget;
    // a non-const pointer to the associated gl context
    QGLContext *glContext;

    M::OrientationAngle angle;

    MSceneManager *sceneManager;

    void notifyWidgetsAboutOrientationChange();

    M::Orientation oldOrientation;
    bool orientationAngleLocked;
    bool orientationLocked;

    bool isLogicallyClosed;
    bool isInSwitcher;
    bool closeOnLazyShutdown;

    void doEnterDisplayEvent();
    void doExitDisplayEvent();
    void doSwitcherEntered();
    void doSwitcherExited();
    void sendExitDisplayEvent(bool delayedSending);

    MOnDisplayChangeEvent *delayedMOnDisplayChangeEvent;
    void propagateMOnDisplayChangeEventToScene(MOnDisplayChangeEvent *event);

    void initGLViewport();
    void initSoftwareViewport();
    void configureViewport();
    void disableAutomaticBackgroundRepainting();

    void takeScreenshot();
    void playScreenshotEffect();

    /**
      * Calling winId() on a QWidget makes this widget a native window.
      * As the meego graphicssystem does not support native windows in native
      * windows we should not call winId() but effectiveWinId() in MWindow.
      * effectiveWinId() return the winId of the first native parent window.
      * When we are not visible on the screen yet effectiveWinId() does always
      * work and will simply return 0 in the worst case. Therefor we manually
      * search for the topmost parent widget and return its winId.
      * Use this method instead of effectiveWinId() when you are not sure if
      * your window is visible yet.
      */
    WId robustEffectiveWinId() const;

    void _q_exitDisplayStabilized();

    bool onDisplay;
    bool onDisplaySet;
    QTimer displayExitedTimer;

    bool visibleInSwitcher;
    bool fullyObscured;

#ifdef HAVE_GCONF
    void _q_updateMinimizedSoftwareSwitch();
    MGConfItem minimizedSoftwareSwitchItem;
#endif
    bool minimizedSoftwareSwitch;

    QElapsedTimer timeSinceLastPaintInSwitcher;
    bool updateIsPending;
    bool discardedPaintEvent;
    bool beforeFirstPaintEvent;
    int invisiblePaintCounter;
    const int allowedPaintEventsWhenInvisible;

protected:
    MWindow *q_ptr;
private:
    void init();
    Q_DECLARE_PUBLIC(MWindow)

};

#endif