Skip to content

Latest commit

 

History

History
95 lines (76 loc) · 2.53 KB

mainwindow.cpp

File metadata and controls

95 lines (76 loc) · 2.53 KB
 
Feb 20, 2013
Feb 20, 2013
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qplatformdefs.h"
#include <QtGui>
Sep 20, 2013
Sep 20, 2013
23
#include <QQmlContext>
Feb 20, 2013
Feb 20, 2013
24
25
26
27
28
29
30
31
32
33
#include "mainwindow.h"
#ifdef MEEGO_EDITION_HARMATTAN
#include <MApplication>
#include <MNotification>
#include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif //MEEGO_EDITION_HARMATTAN
Jul 22, 2013
Jul 22, 2013
34
MainWindow::MainWindow()
Feb 20, 2013
Feb 20, 2013
35
{
Sep 20, 2013
Sep 20, 2013
36
rootContext()->setContextProperty("windowHasFocus", false);
Feb 20, 2013
Feb 20, 2013
37
38
39
40
41
42
43
44
}
MainWindow::~MainWindow()
{
}
void MainWindow::focusInEvent(QFocusEvent *event)
{
Sep 20, 2013
Sep 20, 2013
45
rootContext()->setContextProperty("windowHasFocus", true);
Jul 22, 2013
Jul 22, 2013
46
QQuickView::focusInEvent(event);
Feb 20, 2013
Feb 20, 2013
47
48
49
50
51
emit focusChanged(true);
}
void MainWindow::focusOutEvent(QFocusEvent *event)
{
Sep 20, 2013
Sep 20, 2013
52
rootContext()->setContextProperty("windowHasFocus", false);
Jul 22, 2013
Jul 22, 2013
53
QQuickView::focusOutEvent(event);
Feb 20, 2013
Feb 20, 2013
54
55
56
57
58
emit focusChanged(false);
}
void MainWindow::minimize()
{
Jul 22, 2013
Jul 22, 2013
59
setWindowState(Qt::WindowMinimized);
Feb 20, 2013
Feb 20, 2013
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
}
void MainWindow::disableSwipe()
{
#ifdef MEEGO_EDITION_HARMATTAN
resize(MApplication::desktop()->screenGeometry().width(),
MApplication::desktop()->screenGeometry().height());
showFullScreen();
unsigned int customRegion[] =
{
rect().x(),
rect().y(),
rect().width(),
rect().height()
};
Display *dpy = QX11Info::display();
Atom customRegionAtom = XInternAtom(dpy, "_MEEGOTOUCH_CUSTOM_REGION", False);
XChangeProperty(dpy, effectiveWinId(), customRegionAtom,
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&customRegion[0]), 4);
#endif //MEEGO_EDITION_HARMATTAN
}
void MainWindow::enableSwipe()
{
#ifdef MEEGO_EDITION_HARMATTAN
Display *dpy = QX11Info::display();
Atom customRegionAtom = XInternAtom(dpy, "_MEEGOTOUCH_CUSTOM_REGION", False);
XDeleteProperty(dpy, effectiveWinId(), customRegionAtom);
#endif //MEEGO_EDITION_HARMATTAN
}