Qt 4.8
Classes | Functions
qeventdispatcher_win_p.h File Reference
#include "QtCore/qabstracteventdispatcher.h"
#include "QtCore/qt_windows.h"

Go to the source code of this file.

Classes

class  QEventDispatcherWin32
 

Functions

LRESULT QT_WIN_CALLBACK qt_internal_proc (HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
 

Function Documentation

◆ qt_internal_proc()

LRESULT QT_WIN_CALLBACK qt_internal_proc ( HWND  hwnd,
UINT  message,
WPARAM  wp,
LPARAM  lp 
)

Definition at line 430 of file qeventdispatcher_win.cpp.

Referenced by qt_create_internal_window(), and QEventDispatcherWin32Private::~QEventDispatcherWin32Private().

431 {
432  if (message == WM_NCCREATE)
433  return true;
434 
435  MSG msg;
436  msg.hwnd = hwnd;
437  msg.message = message;
438  msg.wParam = wp;
439  msg.lParam = lp;
441  long result;
442  if (!app) {
443  if (message == WM_TIMER)
444  KillTimer(hwnd, wp);
445  return 0;
446  } else if (app->filterEvent(&msg, &result)) {
447  return result;
448  }
449 
450 #ifdef GWLP_USERDATA
451  QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
452 #else
453  QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA);
454 #endif
456  if (q != 0)
457  d = q->d_func();
458 
459  if (message == WM_QT_SOCKETNOTIFIER) {
460  // socket notifier message
461  int type = -1;
462  switch (WSAGETSELECTEVENT(lp)) {
463  case FD_READ:
464  case FD_CLOSE:
465  case FD_ACCEPT:
466  type = 0;
467  break;
468  case FD_WRITE:
469  case FD_CONNECT:
470  type = 1;
471  break;
472  case FD_OOB:
473  type = 2;
474  break;
475  }
476  if (type >= 0) {
477  Q_ASSERT(d != 0);
478  QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };
479  QSNDict *dict = sn_vec[type];
480 
481  QSockNot *sn = dict ? dict->value(wp) : 0;
482  if (sn) {
485  }
486  }
487  return 0;
488  } else if (message == WM_QT_SENDPOSTEDEVENTS
489  // we also use a Windows timer to send posted events when the message queue is full
490  || (message == WM_TIMER
492  && wp == (uint)d->sendPostedEventsWindowsTimerId)) {
493  int localSerialNumber = d->serialNumber;
494  if (localSerialNumber != d->lastSerialNumber) {
495  d->lastSerialNumber = localSerialNumber;
497  }
498  return 0;
499  } else if (message == WM_TIMER) {
500  Q_ASSERT(d != 0);
501  d->sendTimerEvent(wp);
502  return 0;
503  }
504 
505  return DefWindowProc(hwnd, message, wp, lp);
506 }
double d
Definition: qnumeric_p.h:62
QSocketNotifier * obj
static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data)
int type
Definition: qmetatype.cpp:239
EventRef event
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QThreadData * threadData
Definition: qobject_p.h:195
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
unsigned int uint
Definition: qglobal.h:996
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QCoreApplication class provides an event loop for console Qt applications.
struct tagMSG MSG
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
#define WSAGETSELECTEVENT(lParam)
bool filterEvent(void *message, long *result)
Sends message through the event filter that was set by setEventFilter().
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define WM_NCCREATE