diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-08-08 14:33:33 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-08-08 14:34:33 -0500 |
commit | 1f3ee12a9a3fc09f69f45201c857a02b7abb127c (patch) | |
tree | 81d7a87faf8d152eda0e1377b7ea0da2743308d9 /tdecore/tdeapplication.cpp | |
parent | c8d64e3c7b8b6da34c3aa9acc2fbac750e122786 (diff) | |
download | tdelibs-1f3ee12a9a3fc09f69f45201c857a02b7abb127c.tar.gz tdelibs-1f3ee12a9a3fc09f69f45201c857a02b7abb127c.zip |
Change mount API to allow for mount backends other than pmount
Add static convenience method for determining X11 VT mapping to TDEApplication
Diffstat (limited to 'tdecore/tdeapplication.cpp')
-rw-r--r-- | tdecore/tdeapplication.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tdecore/tdeapplication.cpp b/tdecore/tdeapplication.cpp index 857c157e8..9a5bd7a0b 100644 --- a/tdecore/tdeapplication.cpp +++ b/tdecore/tdeapplication.cpp @@ -175,6 +175,14 @@ typedef void* IceIOErrorHandler; #include <tqimage.h> #endif +#if defined Q_WS_X11 +#include <sys/ioctl.h> +#include <linux/vt.h> +extern "C" { +extern int getfd(const char *fnam); +} +#endif + #include "kappdcopiface.h" // exported for tdm kfrontend @@ -242,6 +250,67 @@ void TDEApplication_init_windows(bool GUIenabled); class QAssistantClient; #endif +#ifdef Q_WS_X11 +// -------------------------------------------------------------------------------------- +// Get the VT number X is running on +// (code taken from GDM, daemon/getvt.c, GPLv2+) +// -------------------------------------------------------------------------------------- +int get_x_vtnum(Display *dpy) +{ + Atom prop; + Atom actualtype; + int actualformat; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *buf; + int num; + + prop = XInternAtom (dpy, "XFree86_VT", False); + if (prop == None) + return -1; + + if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), prop, 0, 1, + False, AnyPropertyType, &actualtype, &actualformat, + &nitems, &bytes_after, &buf)) { + return -1; + } + + if (nitems != 1) { + XFree (buf); + return -1; + } + + switch (actualtype) { + case XA_CARDINAL: + case XA_INTEGER: + case XA_WINDOW: + switch (actualformat) { + case 8: + num = (*(uint8_t *)(void *)buf); + break; + case 16: + num = (*(uint16_t *)(void *)buf); + break; + case 32: + num = (*(uint32_t *)(void *)buf); + break; + default: + XFree (buf); + return -1; + } + break; + default: + XFree (buf); + return -1; + } + + XFree (buf); + + return num; +} +// -------------------------------------------------------------------------------------- +#endif // Q_WS_X11 + /* Private data to make keeping binary compatibility easier */ @@ -3632,6 +3701,18 @@ TQ_ButtonState TDEApplication::keyboardMouseState() return static_cast< ButtonState >( ret ); } +#if defined Q_WS_X11 +int TDEApplication::currentX11VT() +{ + return get_x_vtnum(TQPaintDevice::x11AppDisplay()); +} +#else // Q_WS_X11 +int TDEApplication::currentX11VT() +{ + return -1; +} +#endif // Q_WS_X11 + void TDEApplication::installSigpipeHandler() { #ifdef Q_OS_UNIX |