summaryrefslogtreecommitdiff
path: root/x11/libqpe-x11
authorzecke <zecke>2002-10-18 01:34:23 (UTC)
committer zecke <zecke>2002-10-18 01:34:23 (UTC)
commit0457c48c165abef8afa2ac73c8f66d20e289681a (patch) (side-by-side diff)
tree2c6baf363487d474df6ceeaf2ea17a351b38aa05 /x11/libqpe-x11
parente7e36afd3685c7fab146ebd0078d7f1a60f8c5e6 (diff)
downloadopie-0457c48c165abef8afa2ac73c8f66d20e289681a.zip
opie-0457c48c165abef8afa2ac73c8f66d20e289681a.tar.gz
opie-0457c48c165abef8afa2ac73c8f66d20e289681a.tar.bz2
Fix OCOPServer bugs... when removing clients
Implement the Opie side for the OK button now the awesome matchbox needs to get an update I was too excited about X11 so i did not do any PIM work yet
Diffstat (limited to 'x11/libqpe-x11') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp90
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.h2
2 files changed, 92 insertions, 0 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 8785c74..75a8189 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -7,2 +7,3 @@
+
#include <qdir.h>
@@ -18,2 +19,3 @@
#include <qregexp.h>
+#include <qtimer.h>
@@ -36,2 +38,11 @@
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+const int XKeyPress = KeyPress;
+const int XKeyRelease = KeyRelease;
+#undef KeyPress
+#undef KeyRelease
+
namespace {
@@ -78,2 +89,7 @@ public:
QString decorationName;
+ Atom wm_delete_window;
+ Atom wm_take_focus;
+ Atom wm_context_help;
+ Atom wm_context_accept;
+ Atom wm_protocols;
@@ -221,2 +237,28 @@ QPEApplication::QPEApplication(int &arg, char** argv, Type t)
+ // Init X-Atom
+ Atom *atoms[5];
+ Atom atoms_re[5];
+ char* names[5];
+ int n = 0;
+ atoms[n] = &d->wm_delete_window;
+ names[n++] = "WM_DELETE_WINDOW";
+
+ atoms[n] = &d->wm_take_focus;
+ names[n++] = "WM_TAKE_FOCUS";
+
+ atoms[n] = &d->wm_context_help;
+ names[n++] = "_NET_WM_CONTEXT_HELP";
+
+ atoms[n] = &d->wm_context_accept;
+ names[n++] = "_NET_WM_CONTEXT_ACCEPT";
+
+ atoms[n] = &d->wm_protocols;
+ names[n++] = "WM_PROTOCOLS";
+
+ XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re);
+ // now copy the values over to the properties
+ for (int i = 0; i < n; i++ )
+ *atoms[i] = atoms_re[i];
+ // done with X11 Stuff
+
int dw = desktop()->width();
@@ -532,2 +574,22 @@ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) {
bool QPEApplication::eventFilter( QObject* o, QEvent* e ) {
+ /*
+ * We want our WM to show Ok and a X button
+ * on dialogs
+ * our part is to set the _NET_WM_CONTEXT_ACCEPT
+ * propery
+ * and then wait for a client message -zecke
+ * on show we will add the prop
+ */
+ if (o->inherits("QDialog") && e->type() == QEvent::Show ) {
+ QDialog* dialog = (QDialog*)o;
+ Atom wm_prot[45];
+ int n = 0;
+ wm_prot[n++] = d->wm_delete_window;
+ wm_prot[n++] = d->wm_take_focus;
+ wm_prot[n++] = d->wm_context_accept;
+ if ( dialog->testWFlags( WStyle_ContextHelp ) )
+ wm_prot[n++] = d->wm_context_help;
+ XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n );
+ return TRUE; // should be save
+ }
if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
@@ -659,2 +721,30 @@ void QPEApplication::prepareForTermination( bool willrestart )
}
+int QPEApplication::x11ClientMessage(QWidget* w, XEvent* event, bool b ) {
+ qWarning("X11 ClientMessage %d %d", event->type, ClientMessage);
+ if ( event->type == ClientMessage ) {
+ if ( (event->xclient.message_type == d->wm_protocols) &&
+ (event->xclient.data.l[0] == d->wm_context_accept ) ) {
+ qWarning("accepted!!!");
+ /*
+ * I'm not sure if we should use activeWidget
+ * or activeModalWidget
+ * a QDialog could be not modal too
+ */
+ if ( w->inherits("QDialog" ) ) {
+ qWarning("inherits QDialog!!!");
+ QDialog* dia = (QDialog*)w;
+ /*
+ * call it directly or via QTimer::singleShot?
+ */
+ QTimer::singleShot(0, dia, SLOT(reject() ) );
+ return 0;
+ }
+
+ }
+ }
+ return QApplication::x11ClientMessage(w, event, b );
+}
+
+#define KeyPress XKeyPress
+#define KeyRelease XKeyRelease
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h
index 333f331..254fbfa 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.h
+++ b/x11/libqpe-x11/qpe/qpeapplication.h
@@ -63,2 +63,4 @@ public:
};
+ /* reimplemented for internal purposes */
+ int x11ClientMessage( QWidget*, XEvent*, bool );