1 |
// qsampler.cpp |
// qsampler.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
33 |
#include <QDir> |
#include <QDir> |
34 |
#endif |
#endif |
35 |
|
|
36 |
#define CONFIG_QUOTE1(x) #x |
#ifndef CONFIG_PREFIX |
37 |
#define CONFIG_QUOTED(x) CONFIG_QUOTE1(x) |
#define CONFIG_PREFIX "/usr/local" |
38 |
|
#endif |
39 |
|
|
40 |
#if defined(DATADIR) |
#ifndef CONFIG_DATADIR |
41 |
#define CONFIG_DATADIR CONFIG_QUOTED(DATADIR) |
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
|
#else |
|
|
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
|
42 |
#endif |
#endif |
43 |
|
|
44 |
#if WIN32 |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
45 |
#define RELATIVE_LOCALE_DIR "/share/locale" |
#define RELATIVE_LOCALE_DIR "/share/locale" |
46 |
#elif defined(__APPLE__) |
#elif defined(__APPLE__) |
47 |
#define RELATIVE_LOCALE_DIR "/../Resources" |
#define RELATIVE_LOCALE_DIR "/../Resources" |
168 |
} |
} |
169 |
#ifdef CONFIG_X11 |
#ifdef CONFIG_X11 |
170 |
#ifdef CONFIG_XUNIQUE |
#ifdef CONFIG_XUNIQUE |
171 |
// Instance uniqueness initialization... |
m_pDisplay = NULL; |
172 |
m_pDisplay = QX11Info::display(); |
m_aUnique = 0; |
173 |
m_aUnique = XInternAtom(m_pDisplay, QSAMPLER_XUNIQUE, false); |
m_wOwner = 0; |
|
XGrabServer(m_pDisplay); |
|
|
m_wOwner = XGetSelectionOwner(m_pDisplay, m_aUnique); |
|
|
XUngrabServer(m_pDisplay); |
|
174 |
#if QT_VERSION >= 0x050100 |
#if QT_VERSION >= 0x050100 |
175 |
m_pXcbEventFilter = new qsamplerXcbEventFilter(this); |
m_pXcbEventFilter = new qsamplerXcbEventFilter(this); |
176 |
installNativeEventFilter(m_pXcbEventFilter); |
installNativeEventFilter(m_pXcbEventFilter); |
177 |
|
if (QX11Info::isPlatformX11()) { |
178 |
|
#endif |
179 |
|
// Instance uniqueness initialization... |
180 |
|
m_pDisplay = QX11Info::display(); |
181 |
|
m_aUnique = XInternAtom(m_pDisplay, QSAMPLER_XUNIQUE, false); |
182 |
|
XGrabServer(m_pDisplay); |
183 |
|
m_wOwner = XGetSelectionOwner(m_pDisplay, m_aUnique); |
184 |
|
XUngrabServer(m_pDisplay); |
185 |
|
#if QT_VERSION >= 0x050100 |
186 |
|
} |
187 |
#endif |
#endif |
188 |
#endif // CONFIG_XUNIQUE |
#endif // CONFIG_XUNIQUE |
189 |
#endif // CONFIG_X11 |
#endif // CONFIG_X11 |
210 |
m_pWidget = pWidget; |
m_pWidget = pWidget; |
211 |
#ifdef CONFIG_X11 |
#ifdef CONFIG_X11 |
212 |
#ifdef CONFIG_XUNIQUE |
#ifdef CONFIG_XUNIQUE |
|
XGrabServer(m_pDisplay); |
|
213 |
m_wOwner = m_pWidget->winId(); |
m_wOwner = m_pWidget->winId(); |
214 |
XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime); |
if (m_pDisplay && m_wOwner) { |
215 |
XUngrabServer(m_pDisplay); |
XGrabServer(m_pDisplay); |
216 |
|
XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime); |
217 |
|
XUngrabServer(m_pDisplay); |
218 |
|
} |
219 |
#endif // CONFIG_XUNIQUE |
#endif // CONFIG_XUNIQUE |
220 |
#endif // CONFIG_X11 |
#endif // CONFIG_X11 |
221 |
} |
} |
228 |
{ |
{ |
229 |
#ifdef CONFIG_X11 |
#ifdef CONFIG_X11 |
230 |
#ifdef CONFIG_XUNIQUE |
#ifdef CONFIG_XUNIQUE |
231 |
if (m_wOwner != None) { |
if (m_pDisplay && m_wOwner != None) { |
232 |
// First, notify any freedesktop.org WM |
// First, notify any freedesktop.org WM |
233 |
// that we're about to show the main widget... |
// that we're about to show the main widget... |
234 |
Screen *pScreen = XDefaultScreenOfDisplay(m_pDisplay); |
Screen *pScreen = XDefaultScreenOfDisplay(m_pDisplay); |
273 |
#ifdef CONFIG_XUNIQUE |
#ifdef CONFIG_XUNIQUE |
274 |
void x11PropertyNotify(Window w) |
void x11PropertyNotify(Window w) |
275 |
{ |
{ |
276 |
if (m_pWidget && m_wOwner == w) { |
if (m_pDisplay && m_pWidget && m_wOwner == w) { |
277 |
// Always check whether our property-flag is still around... |
// Always check whether our property-flag is still around... |
278 |
Atom aType; |
Atom aType; |
279 |
int iFormat = 0; |
int iFormat = 0; |
435 |
#endif |
#endif |
436 |
#endif |
#endif |
437 |
qsamplerApplication app(argc, argv); |
qsamplerApplication app(argc, argv); |
438 |
|
#if QT_VERSION >= 0x050600 |
439 |
|
app.setAttribute(Qt::AA_EnableHighDpiScaling); |
440 |
|
#endif |
441 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
442 |
{ |
{ |
443 |
// Set the plugin path to @exetutable_path/../plugins |
// Set the plugin path to @exetutable_path/../plugins |
516 |
|
|
517 |
|
|
518 |
// end of qsampler.cpp |
// end of qsampler.cpp |
519 |
|
|