src/gui/kernel/qwidget_win.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   121 static PtrWTOpen ptrWTOpen = 0;
   121 static PtrWTOpen ptrWTOpen = 0;
   122 static PtrWTClose ptrWTClose = 0;
   122 static PtrWTClose ptrWTClose = 0;
   123 static PtrWTInfo ptrWTInfo = 0;
   123 static PtrWTInfo ptrWTInfo = 0;
   124 static PtrWTQueueSizeGet ptrWTQueueSizeGet = 0;
   124 static PtrWTQueueSizeGet ptrWTQueueSizeGet = 0;
   125 static PtrWTQueueSizeSet ptrWTQueueSizeSet = 0;
   125 static PtrWTQueueSizeSet ptrWTQueueSizeSet = 0;
       
   126 #ifndef QT_NO_TABLETEVENT
   126 static void init_wintab_functions();
   127 static void init_wintab_functions();
   127 static void qt_tablet_init();
   128 static void qt_tablet_init();
   128 static void qt_tablet_cleanup();
   129 static void qt_tablet_cleanup();
       
   130 #endif // QT_NO_TABLETEVENT
   129 extern HCTX qt_tablet_context;
   131 extern HCTX qt_tablet_context;
   130 extern bool qt_tablet_tilt_support;
   132 extern bool qt_tablet_tilt_support;
   131 
   133 
   132 static QWidget *qt_tablet_widget = 0;
   134 static QWidget *qt_tablet_widget = 0;
   133 QWidget* qt_get_tablet_widget()
   135 QWidget* qt_get_tablet_widget()
   134 {
   136 {
   135     return qt_tablet_widget;
   137     return qt_tablet_widget;
   136 }
   138 }
   137 
   139 
   138 extern bool qt_is_gui_used;
   140 extern bool qt_is_gui_used;
       
   141 
       
   142 #ifndef QT_NO_TABLETEVENT
   139 static void init_wintab_functions()
   143 static void init_wintab_functions()
   140 {
   144 {
   141 #if defined(Q_OS_WINCE)
   145 #if defined(Q_OS_WINCE)
   142     return;
   146     return;
   143 #else
   147 #else
   225     if (ptrWTClose)
   229     if (ptrWTClose)
   226         ptrWTClose(qt_tablet_context);
   230         ptrWTClose(qt_tablet_context);
   227     delete qt_tablet_widget;
   231     delete qt_tablet_widget;
   228     qt_tablet_widget = 0;
   232     qt_tablet_widget = 0;
   229 }
   233 }
       
   234 #endif // QT_NO_TABLETEVENT
   230 
   235 
   231 const QString qt_reg_winclass(QWidget *w);                // defined in qapplication_win.cpp
   236 const QString qt_reg_winclass(QWidget *w);                // defined in qapplication_win.cpp
   232 
   237 
   233 #ifndef QT_NO_DRAGANDDROP
   238 #ifndef QT_NO_DRAGANDDROP
   234 void            qt_olednd_unregister(QWidget* widget, QOleDropTarget *dst); // dnd_win
   239 void            qt_olednd_unregister(QWidget* widget, QOleDropTarget *dst); // dnd_win
   241 static QWidget *mouseGrb    = 0;
   246 static QWidget *mouseGrb    = 0;
   242 static QCursor *mouseGrbCur = 0;
   247 static QCursor *mouseGrbCur = 0;
   243 static QWidget *keyboardGrb = 0;
   248 static QWidget *keyboardGrb = 0;
   244 static HHOOK   journalRec  = 0;
   249 static HHOOK   journalRec  = 0;
   245 
   250 
   246 extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM);
   251 extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM);
   247 
   252 
   248 #define XCOORD_MAX 16383
   253 #define XCOORD_MAX 16383
   249 #define WRECT_MAX 16383
   254 #define WRECT_MAX 16383
   250 
   255 
   251 /*****************************************************************************
   256 /*****************************************************************************
   510 
   515 
   511     if (destroyw) {
   516     if (destroyw) {
   512         DestroyWindow(destroyw);
   517         DestroyWindow(destroyw);
   513     }
   518     }
   514 
   519 
       
   520 #ifndef QT_NO_TABLETEVENT
   515     if (q != qt_tablet_widget && QWidgetPrivate::mapper)
   521     if (q != qt_tablet_widget && QWidgetPrivate::mapper)
   516         qt_tablet_init();
   522         qt_tablet_init();
       
   523 #endif // QT_NO_TABLETEVENT
   517 
   524 
   518     if (q->testAttribute(Qt::WA_DropSiteRegistered))
   525     if (q->testAttribute(Qt::WA_DropSiteRegistered))
   519         registerDropSite(true);
   526         registerDropSite(true);
   520 
   527 
   521     if (maybeTopData() && maybeTopData()->opacity != 255)
   528     if (maybeTopData() && maybeTopData()->opacity != 255)
   823     return mouseGrbCur;
   830     return mouseGrbCur;
   824 }
   831 }
   825 
   832 
   826 // The procedure does nothing, but is required for mousegrabbing to work
   833 // The procedure does nothing, but is required for mousegrabbing to work
   827 #ifndef Q_WS_WINCE
   834 #ifndef Q_WS_WINCE
   828 LRESULT CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam)
   835 LRESULT QT_WIN_CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam)
   829 {
   836 {
   830     return CallNextHookEx(journalRec, nCode, wParam, lParam);
   837     return CallNextHookEx(journalRec, nCode, wParam, lParam);
   831 }
   838 }
   832 #endif //Q_WS_WINCE
   839 #endif //Q_WS_WINCE
   833 
   840 
  1090     Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
  1097     Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
  1091 
  1098 
  1092     if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
  1099     if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
  1093         invalidateBuffer(q->rect());
  1100         invalidateBuffer(q->rect());
  1094         return;
  1101         return;
       
  1102     }
       
  1103 
       
  1104     if (data.window_flags & Qt::Window) {
       
  1105         QTLWExtra *extra = topData();
       
  1106         if (!extra->hotkeyRegistered) {
       
  1107             // Try to set the hotkey using information from STARTUPINFO
       
  1108             STARTUPINFO startupInfo;
       
  1109             GetStartupInfo(&startupInfo);
       
  1110             // If STARTF_USEHOTKEY is set, hStdInput is the virtual keycode
       
  1111             if (startupInfo.dwFlags & 0x00000200) {
       
  1112                 WPARAM hotKey = (WPARAM)startupInfo.hStdInput;
       
  1113                 SendMessage(data.winid, WM_SETHOTKEY, hotKey, 0);
       
  1114             }
       
  1115             extra->hotkeyRegistered = 1;
       
  1116         }
  1095     }
  1117     }
  1096 
  1118 
  1097     int sm = SW_SHOWNORMAL;
  1119     int sm = SW_SHOWNORMAL;
  1098     bool fakedMaximize = false;
  1120     bool fakedMaximize = false;
  1099     if (q->isWindow()) {
  1121     if (q->isWindow()) {
  1139     if (q->internalWinId()) {
  1161     if (q->internalWinId()) {
  1140         if (IsIconic(q->internalWinId()))
  1162         if (IsIconic(q->internalWinId()))
  1141             data.window_state |= Qt::WindowMinimized;
  1163             data.window_state |= Qt::WindowMinimized;
  1142         if (IsZoomed(q->internalWinId()))
  1164         if (IsZoomed(q->internalWinId()))
  1143             data.window_state |= Qt::WindowMaximized;
  1165             data.window_state |= Qt::WindowMaximized;
       
  1166         // This is to resolve the problem where popups are opened from the
       
  1167         // system tray and not being implicitly activated
       
  1168         if (q->windowType() == Qt::Popup &&
       
  1169             (!q->parentWidget() || !q->parentWidget()->isActiveWindow()))
       
  1170             q->activateWindow();
  1144     }
  1171     }
  1145 
  1172 
  1146     winSetupGestures();
  1173     winSetupGestures();
  1147 
  1174 
  1148     invalidateBuffer(q->rect());
  1175     invalidateBuffer(q->rect());
  1685 }
  1712 }
  1686 #endif //Q_WS_WINCE
  1713 #endif //Q_WS_WINCE
  1687 
  1714 
  1688 void QWidgetPrivate::createTLSysExtra()
  1715 void QWidgetPrivate::createTLSysExtra()
  1689 {
  1716 {
       
  1717     extra->topextra->hotkeyRegistered = 0;
  1690     extra->topextra->savedFlags = 0;
  1718     extra->topextra->savedFlags = 0;
  1691     extra->topextra->winIconBig = 0;
  1719     extra->topextra->winIconBig = 0;
  1692     extra->topextra->winIconSmall = 0;
  1720     extra->topextra->winIconSmall = 0;
  1693 }
  1721 }
  1694 
  1722