summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-03 15:46:20 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-03 15:46:20 (GMT)
commit0489ba37346e4f8efc4a7c1661a60905dc4aa423 (patch)
tree9974317f49b9fbad41e77aa7c24783f988c38d89 /src
parent7dacb5be7a97657754c844882f9e68365fd474d4 (diff)
parentbe1037d7b6bcdf0ab34fe7fab00d706f8daa01b5 (diff)
downloadQt-0489ba37346e4f8efc4a7c1661a60905dc4aa423.zip
Qt-0489ba37346e4f8efc4a7c1661a60905dc4aa423.tar.gz
Qt-0489ba37346e4f8efc4a7c1661a60905dc4aa423.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Removed unused macro. Fix runtime warning on Gtk versions < 2.16 Fix compile Follow-up to c1b067e: fix aliasing in QReadWriteLock too. Bug with toolbar focus on Mac
Diffstat (limited to 'src')
-rw-r--r--src/corelib/thread/qreadwritelock.h30
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qwidget.cpp17
-rw-r--r--src/gui/kernel/qwidget_mac.mm6
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp17
-rw-r--r--src/gui/styles/qgtkstyle_p.h8
6 files changed, 41 insertions, 41 deletions
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 278b8d4..9521ac3 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -96,19 +96,19 @@ public:
inline void unlock()
{
- if (q_lock) {
+ if (q_val) {
if ((q_val & quintptr(1u)) == quintptr(1u)) {
q_val &= ~quintptr(1u);
- q_lock->unlock();
+ readWriteLock()->unlock();
}
}
}
inline void relock()
{
- if (q_lock) {
+ if (q_val) {
if ((q_val & quintptr(1u)) == quintptr(0u)) {
- q_lock->lockForRead();
+ readWriteLock()->lockForRead();
q_val |= quintptr(1u);
}
}
@@ -119,14 +119,11 @@ public:
private:
Q_DISABLE_COPY(QReadLocker)
- union {
- QReadWriteLock *q_lock;
- quintptr q_val;
- };
+ quintptr q_val;
};
inline QReadLocker::QReadLocker(QReadWriteLock *areadWriteLock)
- : q_lock(areadWriteLock)
+ : q_val(reinterpret_cast<quintptr>(areadWriteLock))
{
Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0),
"QReadLocker", "QReadWriteLock pointer is misaligned");
@@ -143,19 +140,19 @@ public:
inline void unlock()
{
- if (q_lock) {
+ if (q_val) {
if ((q_val & quintptr(1u)) == quintptr(1u)) {
q_val &= ~quintptr(1u);
- q_lock->unlock();
+ readWriteLock()->unlock();
}
}
}
inline void relock()
{
- if (q_lock) {
+ if (q_val) {
if ((q_val & quintptr(1u)) == quintptr(0u)) {
- q_lock->lockForWrite();
+ readWriteLock()->lockForWrite();
q_val |= quintptr(1u);
}
}
@@ -167,14 +164,11 @@ public:
private:
Q_DISABLE_COPY(QWriteLocker)
- union{
- QReadWriteLock *q_lock;
- quintptr q_val;
- };
+ quintptr q_val;
};
inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock)
- : q_lock(areadWriteLock)
+ : q_val(reinterpret_cast<quintptr>(areadWriteLock))
{
Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0),
"QWriteLocker", "QReadWriteLock pointer is misaligned");
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 6dda961..4fe3900 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -117,10 +117,6 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
-#ifndef QT_GUI_DOUBLE_CLICK_RADIUS
-#define QT_GUI_DOUBLE_CLICK_RADIUS 5
-#endif
-
//#define ALIEN_DEBUG
static void initResources()
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 29ae51f..b5ccb3e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7535,6 +7535,23 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
continue;
+#ifdef QT_MAC_USE_COCOA
+ // Before doing anything we need to make sure that we don't leave anything in a non-consistent state.
+ // When hiding a widget we need to make sure that no mouse_down events are active, because
+ // the mouse_up event will never be received by a hidden widget or one of its descendants.
+ // The solution is simple, before going through with this we check if there are any mouse_down events in
+ // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and
+ // then we continue.
+ // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already
+ // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the
+ // mouse release event. There are two ways to interpret this:
+ // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it
+ // might be waiting for a release event that will never arrive.
+ // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not
+ // supposed to trigger because it is not visible.
+ if(widget == qt_button_down)
+ qt_button_down = 0;
+#endif // QT_MAC_USE_COCOA
if (spontaneous)
widget->setAttribute(Qt::WA_Mapped, false);
else
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index c7acf69..5bce17f 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -152,6 +152,7 @@ static bool qt_mac_raise_process = true;
static OSWindowRef qt_root_win = 0;
QWidget *mac_mouse_grabber = 0;
QWidget *mac_keyboard_grabber = 0;
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
#ifndef QT_MAC_USE_COCOA
#ifdef QT_NAMESPACE
@@ -866,7 +867,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
& ~Qt::WindowMaximized));
QApplication::sendSpontaneousEvent(widget, &e);
}
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
qt_button_down = 0;
} else if(ekind == kEventWindowCollapsed) {
if (!widget->isMinimized()) {
@@ -894,7 +894,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
//we send a hide to be like X11/Windows
QEvent e(QEvent::Hide);
QApplication::sendSpontaneousEvent(widget, &e);
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
qt_button_down = 0;
} else if(ekind == kEventWindowToolbarSwitchMode) {
macSendToolbarChangeEvent(widget);
@@ -1519,7 +1518,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if (widget) {
qt_event_request_window_change(widget);
if (!HIViewIsVisible(HIViewRef(widget->winId()))) {
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
if (widget == qt_button_down)
qt_button_down = 0;
}
@@ -1528,7 +1526,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
break; }
case kEventClassMouse: {
bool send_to_app = false;
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
if(qt_button_down)
send_to_app = true;
if(send_to_app) {
@@ -3405,7 +3402,6 @@ void QWidgetPrivate::hide_sys()
Q_Q(QWidget);
if((q->windowType() == Qt::Desktop)) //you can't hide the desktop!
return;
-
QMacCocoaAutoReleasePool pool;
if(q->isWindow()) {
OSWindowRef window = qt_mac_window_for(q);
diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
index a033407..f3c7a5b 100644
--- a/src/gui/styles/qgtkstyle_p.cpp
+++ b/src/gui/styles/qgtkstyle_p.cpp
@@ -91,8 +91,8 @@ Ptr_gtk_widget_set_default_direction QGtkStylePrivate::gtk_widget_set_default_di
Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_fg = 0;
Ptr_gtk_widget_modify_color QGtkStylePrivate::gtk_widget_modify_bg = 0;
Ptr_gtk_arrow_new QGtkStylePrivate::gtk_arrow_new = 0;
-Ptr_gtk_menu_item_new QGtkStylePrivate::gtk_menu_item_new = 0;
-Ptr_gtk_check_menu_item_new QGtkStylePrivate::gtk_check_menu_item_new = 0;
+Ptr_gtk_menu_item_new_with_label QGtkStylePrivate::gtk_menu_item_new_with_label = 0;
+Ptr_gtk_check_menu_item_new_with_label QGtkStylePrivate::gtk_check_menu_item_new_with_label = 0;
Ptr_gtk_menu_bar_new QGtkStylePrivate::gtk_menu_bar_new = 0;
Ptr_gtk_menu_new QGtkStylePrivate::gtk_menu_new = 0;
Ptr_gtk_button_new QGtkStylePrivate::gtk_button_new = 0;
@@ -347,8 +347,8 @@ void QGtkStylePrivate::resolveGtk() const
gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_fg");
gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_bg");
gtk_arrow_new = (Ptr_gtk_arrow_new)libgtk.resolve("gtk_arrow_new");
- gtk_menu_item_new = (Ptr_gtk_menu_item_new)libgtk.resolve("gtk_menu_item_new");
- gtk_check_menu_item_new = (Ptr_gtk_check_menu_item_new)libgtk.resolve("gtk_check_menu_item_new");
+ gtk_menu_item_new_with_label = (Ptr_gtk_menu_item_new_with_label)libgtk.resolve("gtk_menu_item_new_with_label");
+ gtk_check_menu_item_new_with_label = (Ptr_gtk_check_menu_item_new_with_label)libgtk.resolve("gtk_check_menu_item_new_with_label");
gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)libgtk.resolve("gtk_menu_bar_new");
gtk_menu_new = (Ptr_gtk_menu_new)libgtk.resolve("gtk_menu_new");
gtk_toolbar_new = (Ptr_gtk_toolbar_new)libgtk.resolve("gtk_toolbar_new");
@@ -439,7 +439,7 @@ void QGtkStylePrivate::initGtkMenu() const
GtkWidget *gtkMenuBar = QGtkStylePrivate::gtk_menu_bar_new();
setupGtkWidget(gtkMenuBar);
- GtkWidget *gtkMenuBarItem = QGtkStylePrivate::gtk_menu_item_new();
+ GtkWidget *gtkMenuBarItem = QGtkStylePrivate::gtk_menu_item_new_with_label("X");
gtk_menu_shell_append((GtkMenuShell*)(gtkMenuBar), gtkMenuBarItem);
gtk_widget_realize(gtkMenuBarItem);
@@ -448,14 +448,11 @@ void QGtkStylePrivate::initGtkMenu() const
gtk_menu_item_set_submenu((GtkMenuItem*)(gtkMenuBarItem), gtkMenu);
gtk_widget_realize(gtkMenu);
- GtkWidget *gtkMenuItem = QGtkStylePrivate::gtk_menu_item_new();
- g_object_set(gtkMenuItem, "label", "X", NULL);
-
+ GtkWidget *gtkMenuItem = QGtkStylePrivate::gtk_menu_item_new_with_label("X");
gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem);
gtk_widget_realize(gtkMenuItem);
- GtkWidget *gtkCheckMenuItem = QGtkStylePrivate::gtk_check_menu_item_new();
- g_object_set(gtkCheckMenuItem, "label", "X", NULL);
+ GtkWidget *gtkCheckMenuItem = QGtkStylePrivate::gtk_check_menu_item_new_with_label("X");
gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem);
gtk_widget_realize(gtkCheckMenuItem);
diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h
index db5b9b9..31a16db 100644
--- a/src/gui/styles/qgtkstyle_p.h
+++ b/src/gui/styles/qgtkstyle_p.h
@@ -87,9 +87,9 @@ typedef void (*Ptr_gtk_widget_realize) (GtkWidget *);
typedef void (*Ptr_gtk_widget_set_default_direction) (GtkTextDirection);
typedef void (*Ptr_gtk_widget_modify_color)(GtkWidget *widget, GtkStateType state, const GdkColor *color);
typedef GtkWidget* (*Ptr_gtk_arrow_new)(GtkArrowType, GtkShadowType);
-typedef GtkWidget* (*Ptr_gtk_menu_item_new)(void);
+typedef GtkWidget* (*Ptr_gtk_menu_item_new_with_label)(const gchar *);
typedef GtkWidget* (*Ptr_gtk_separator_menu_item_new)(void);
-typedef GtkWidget* (*Ptr_gtk_check_menu_item_new)(void);
+typedef GtkWidget* (*Ptr_gtk_check_menu_item_new_with_label)(const gchar *);
typedef GtkWidget* (*Ptr_gtk_menu_bar_new)(void);
typedef GtkWidget* (*Ptr_gtk_menu_new)(void);
typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void);
@@ -306,9 +306,9 @@ public:
static Ptr_gtk_widget_set_default_direction gtk_widget_set_default_direction;
static Ptr_gtk_widget_modify_color gtk_widget_modify_fg;
static Ptr_gtk_widget_modify_color gtk_widget_modify_bg;
- static Ptr_gtk_menu_item_new gtk_menu_item_new;
+ static Ptr_gtk_menu_item_new_with_label gtk_menu_item_new_with_label;
static Ptr_gtk_arrow_new gtk_arrow_new;
- static Ptr_gtk_check_menu_item_new gtk_check_menu_item_new;
+ static Ptr_gtk_check_menu_item_new_with_label gtk_check_menu_item_new_with_label;
static Ptr_gtk_menu_bar_new gtk_menu_bar_new;
static Ptr_gtk_menu_new gtk_menu_new;
static Ptr_gtk_expander_new gtk_expander_new;