summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-06-24 10:52:44 -0700
committerAnders Broman <a.broman58@gmail.com>2016-06-26 06:09:58 +0000
commit291762d0af8cd49a19c6fc73fce317ee20816a17 (patch)
treec98be0a248863e45498848af53d750325e074c73 /ui
parent974a530f8edbb31f6f6cacc904f3892b25268d7c (diff)
downloadwireshark-291762d0af8cd49a19c6fc73fce317ee20816a17.tar.gz
Qt: Try to fix un-maximize behavior on OS X.
On OS X, create dialogs with valid parents so that we don't trigger QTBUG-46701. Document QDialog's "on top", maximize, and minimize behaviors. Bug: 12544 Change-Id: I32c0ef01dba3f7132e5fd0cd61f9feb654b92009 Reviewed-on: https://code.wireshark.org/review/16127 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/geometry_state_dialog.cpp7
-rw-r--r--ui/qt/geometry_state_dialog.h38
-rw-r--r--ui/qt/wireshark_dialog.cpp4
-rw-r--r--ui/qt/wireshark_dialog.h2
4 files changed, 40 insertions, 11 deletions
diff --git a/ui/qt/geometry_state_dialog.cpp b/ui/qt/geometry_state_dialog.cpp
index 95469ae4a8..a934a4e10f 100644
--- a/ui/qt/geometry_state_dialog.cpp
+++ b/ui/qt/geometry_state_dialog.cpp
@@ -24,13 +24,6 @@
#include "ui/recent.h"
#include "ui/ui_util.h"
-
-GeometryStateDialog::GeometryStateDialog(QWidget *parent, Qt::WindowFlags f) :
- QDialog(parent, f)
-{
-
-}
-
GeometryStateDialog::~GeometryStateDialog()
{
saveGeometry();
diff --git a/ui/qt/geometry_state_dialog.h b/ui/qt/geometry_state_dialog.h
index 24b2de4a93..28ef1c5450 100644
--- a/ui/qt/geometry_state_dialog.h
+++ b/ui/qt/geometry_state_dialog.h
@@ -29,7 +29,43 @@ class GeometryStateDialog : public QDialog
Q_OBJECT
public:
- explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = 0);
+
+// As discussed in change 7072, QDialogs have different minimize and "on
+// top" behaviors depending on their parents, flags, and platforms.
+//
+// W = Windows, L = Linux, X = OS X
+//
+// QDialog(parent)
+//
+// W,L: Always on top, no minimize button.
+// X: Independent, no minimize button.
+//
+// QDialog(parent, Qt::Window)
+//
+// W: Always on top, minimize button. Minimizes to a small title bar
+// attached to the taskbar and not the taskbar itself. (The GTK+
+// UI used to do this.)
+// L: Always on top, minimize button.
+// X: Independent, minimize button.
+//
+// QDialog(NULL)
+//
+// W, L, X: Independent, no minimize button.
+//
+// QDialog(NULL, Qt::Window)
+//
+// W, L, X: Independent, minimize button.
+//
+// Additionally, maximized, parent-less dialogs can close to a black screen
+// on OS X: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=12544
+//
+// Pass in the parent on OS X and NULL elsewhere so that we have an
+// independent window that un-maximizes correctly.
+#ifdef Q_OS_MAC
+ explicit GeometryStateDialog(QWidget *parent, Qt::WindowFlags f = 0) : QDialog(parent, f) {}
+#else
+ explicit GeometryStateDialog(QWidget *, Qt::WindowFlags f = 0) : QDialog(NULL, f) {}
+#endif
~GeometryStateDialog();
protected:
diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp
index ba5cd12bb1..c7d8d5a5f2 100644
--- a/ui/qt/wireshark_dialog.cpp
+++ b/ui/qt/wireshark_dialog.cpp
@@ -41,8 +41,8 @@
// - Use a dynamic property + Q_PROPERTY for the subtitle.
// - Make our nested event loop more robust. See tryDeleteLater for details.
-WiresharkDialog::WiresharkDialog(QWidget &, CaptureFile &capture_file) :
- GeometryStateDialog(NULL, Qt::Window),
+WiresharkDialog::WiresharkDialog(QWidget &parent, CaptureFile &capture_file) :
+ GeometryStateDialog(&parent, Qt::Window),
cap_file_(capture_file),
file_closed_(false),
retap_depth_(0),
diff --git a/ui/qt/wireshark_dialog.h b/ui/qt/wireshark_dialog.h
index 9cae588ecf..d9482c7606 100644
--- a/ui/qt/wireshark_dialog.h
+++ b/ui/qt/wireshark_dialog.h
@@ -47,7 +47,7 @@ class WiresharkDialog : public GeometryStateDialog
public:
// XXX Unlike the entire QWidget API, parent is mandatory here.
- explicit WiresharkDialog(QWidget &, CaptureFile &capture_file);
+ explicit WiresharkDialog(QWidget &parent, CaptureFile &capture_file);
signals: