Kludget::Kludget(KClient *parent) : QObject(parent), client(parent), window(new KWindow), settings(new KSettings(this)), system(new KSystem(this)), prefWindow(0), aboutWindow(0), firstShow(true) { setObjectName("Kludget"); settings->setRootKey("kludget"); connect(system, SIGNAL(execUpdate(long)), this, SLOT(onSystemExecUpdate(long))); connect(system, SIGNAL(execFinish(long)), this, SLOT(onSystemExecFinish(long))); connect(window, SIGNAL(destroyed()), this, SLOT(onWindowDestroyed())); connect(window, SIGNAL(onShow()), this, SLOT(onShow())); connect(window, SIGNAL(onHide()), this, SLOT(onHide())); connect(window, SIGNAL(onStartDrag()), this, SLOT(onStartDrag())); connect(window, SIGNAL(onEndDrag()), this, SLOT(onEndDrag())); connect(window, SIGNAL(onSettingsChanged()), this, SLOT(onSettingsChanged())); connect(window->view(), SIGNAL(contextMenuRequested()), this, SLOT(onContextMenu())); connect(window->view(), SIGNAL(urlReceived(const QUrl*)), this, SLOT(onUrlReceived(const QUrl*))); connect(window->view()->page(), SIGNAL(loadFinished(bool)), this, SLOT(show())); connect(window->view()->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared())); connect(window->view()->page(), SIGNAL(frameCreated(QWebFrame*)), this, SLOT(onFrameCreated(QWebFrame*))); connect(this, SIGNAL(evaluate(const QString &)), this, SLOT(onEvaluate(const QString &))); connect(&customMenuMapper, SIGNAL(mapped(const QString &)), this, SIGNAL(evaluate(const QString &))); connect(&ipcClient, SIGNAL(messageReceived(QString,QString,QString)), this, SLOT(messageReceived(QString,QString,QString))); KLog::log("Kludget::created"); }
bool HippoAbstractWindow::processMessage(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CLOSE: onClose(false); return true; case WM_DESTROY: onWindowDestroyed(); return true; case WM_SIZE: case WM_MOVE: { HippoRectangle newRect; queryCurrentClientRect(&newRect); onMoveResizeMessage(&newRect); // below disabled since it doesn't matter for HippoAbstractControl // and it might break something. #if 0 // onMoveResizeMessage may have already done this, but if // not we clean it up. This might be a tad dangerous // if onMoveResizeMessage recursively moves/sizes // but it does not right now afaik x_ = newRect.x; y_ = newRect.y; width_ = newRect.width; height_ = newRect.height; g_debug("SIZING: %s saved new size %d,%d %dx%d", HippoUStr(getClassName()).c_str(), x_, y_, width_, height_); #endif } return false; // for e.g. standard Windows controls we want to run DefWindowProc() ? default: return false; } return false; }
void RenderThread::processMessage (const Message& message) { DBG_PRINT(("RenderThread::processMessage(): message = { %s, %p }\n", getMessageTypeName(message.type), message.payload.window)); switch (message.type) { case MESSAGE_RESUME: m_paused = false; break; case MESSAGE_PAUSE: m_paused = true; break; case MESSAGE_FINISH: m_finish = true; break; // \note While Platform / WindowRegistry are currently multi-window -capable, // the fact that platform gives us windows too late / at unexpected times // forces us to do some sanity checking and limit system to one window here. case MESSAGE_WINDOW_CREATED: if (m_windowState != WINDOWSTATE_NOT_CREATED && m_windowState != WINDOWSTATE_DESTROYED) throw InternalError("Got unexpected onNativeWindowCreated() event from system"); m_windowState = WINDOWSTATE_NOT_INITIALIZED; m_window = message.payload.window; break; case MESSAGE_WINDOW_RESIZED: if (m_window != message.payload.window) throw InternalError("Got onNativeWindowResized() event targeting different window"); if (m_windowState == WINDOWSTATE_NOT_INITIALIZED) { // Got first resize event, window is ready for use. m_windowState = WINDOWSTATE_READY; onWindowCreated(message.payload.window); } else if (m_windowState == WINDOWSTATE_READY) onWindowResized(message.payload.window); else throw InternalError("Got unexpected onNativeWindowResized() event from system"); break; case MESSAGE_WINDOW_DESTROYED: if (m_window != message.payload.window) throw InternalError("Got onNativeWindowDestroyed() event targeting different window"); if (m_windowState != WINDOWSTATE_NOT_INITIALIZED && m_windowState != WINDOWSTATE_READY) throw InternalError("Got unexpected onNativeWindowDestroyed() event from system"); if (m_windowState == WINDOWSTATE_READY) onWindowDestroyed(message.payload.window); m_windowState = WINDOWSTATE_DESTROYED; m_window = DE_NULL; break; case MESSAGE_INPUT_QUEUE_CREATED: m_inputQueue = message.payload.inputQueue; break; case MESSAGE_INPUT_QUEUE_DESTROYED: m_inputQueue = message.payload.inputQueue; break; case MESSAGE_SYNC: message.payload.semaphore->increment(); break; default: throw std::runtime_error("Unknown message type"); break; } }