void ViewerWindow::desktopStateUpdate() { // Adjust window of viewer to size of remote desktop. adjustWindowSize(); // Update state of toolbar-buttons (Ctrl, Alt) to hardware-button state. updateKeyState(); }
void ScreenshotGrabber::showGrabber() { this->screenGrab = grabScreen(); this->screenGrabDisplay->setPixmap(this->screenGrab); this->window->show(); this->window->setFocus(); this->window->grabKeyboard(); adjustWindowSize(); adjustTooltipPosition(); }
void SoSimple::setWidgetSize(HWND const widget, const SbVec2s size) { UINT flags = SWP_NOMOVE | SWP_NOZORDER; DWORD style = GetWindowLong(widget, GWL_STYLE), exStyle = GetWindowLong(widget, GWL_EXSTYLE); int width = size[0], height = size[1]; adjustWindowSize(width,height, style, exStyle); SetWindowPos(widget, NULL, 0, 0, width, height, flags); }
void InputSystem::initialise( Ogre::RenderWindow *window, bool exclusive ) { OIS::ParamList paramList; size_t windowHnd = 0; std::ostringstream windowHndStr; window->getCustomAttribute("WINDOW", &windowHnd); windowHndStr << windowHnd; paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); if( ! exclusive ) { #if defined OIS_WIN32_PLATFORM paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" ))); paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE"))); paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND"))); paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE"))); #elif defined OIS_LINUX_PLATFORM paramList.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false"))); paramList.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("true"))); paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false"))); #endif } mInputManager = OIS::InputManager::createInputSystem( paramList ); mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true)); mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true)); mMouse->setEventCallback(this); mKeyboard->setEventCallback( this ); adjustWindowSize( window ); // Cache hash values for creating events. event_keydown = Event::hash( "EVT_KEYDOWN" ); event_keyup = Event::hash( "EVT_KEYUP" ); event_mousedown = Event::hash( "EVT_MOUSEDOWN" ); event_mouseup = Event::hash( "EVT_MOUSEUP" ); event_mousemove = Event::hash( "EVT_MOUSEMOVE" ); }
void MediaView::activeVideoChanged(Video *video, Video *previousVideo) { if (stopped) return; media->stop(); errorTimer->stop(); if (previousVideo && previousVideo != video) { if (previousVideo->isLoadingStreamUrl()) previousVideo->abortLoadStreamUrl(); } // optimize window for 16:9 video adjustWindowSize(); videoAreaWidget->showLoading(video); connect(video, &Video::gotStreamUrl, this, &MediaView::gotStreamUrl, Qt::UniqueConnection); connect(video, SIGNAL(errorStreamUrl(QString)), SLOT(skip()), Qt::UniqueConnection); video->loadStreamUrl(); // video title in titlebar MainWindow::instance()->setWindowTitle(video->getTitle() + QLatin1String(" - ") + QLatin1String(Constants::NAME)); // ensure active item is visible int row = playlistModel->rowForVideo(video); if (row != -1) { QModelIndex index = playlistModel->index(row, 0, QModelIndex()); playlistView->scrollTo(index, QAbstractItemView::EnsureVisible); } // enable/disable actions MainWindow::instance() ->getAction("download") ->setEnabled(DownloadManager::instance()->itemForVideo(video) == nullptr); MainWindow::instance()->getAction("previous")->setEnabled(row > 0); MainWindow::instance()->getAction("stopafterthis")->setEnabled(true); MainWindow::instance()->getAction("relatedVideos")->setEnabled(true); bool enableDownload = video->getLicense() == Video::LicenseCC; #ifdef APP_ACTIVATION enableDownload = enableDownload || Activation::instance().isLegacy(); #endif #ifdef APP_DOWNLOADS enableDownload = true; #endif QAction *a = MainWindow::instance()->getAction("download"); a->setEnabled(enableDownload); a->setVisible(enableDownload); updateSubscriptionAction(video, YTChannel::isSubscribed(video->getChannelId())); for (QAction *action : currentVideoActions) action->setEnabled(true); #ifdef APP_SNAPSHOT if (snapshotSettings) { delete snapshotSettings; snapshotSettings = nullptr; MainWindow::instance()->adjustStatusBarVisibility(); } #endif // see you in gotStreamUrl... }
MainWindow::MainWindow (QWidget* parent) : QMainWindow(parent) { CAImageProvider::s_imageProvider = new CAImageProvider; qmlRegisterType<CACanvasController> ("CalligraActive", 1, 0, "CanvasController"); qmlRegisterType<CADocumentInfo> ("CalligraActive", 1, 0, "CADocumentInfo"); qmlRegisterType<CADocumentController> ("CalligraActive", 1, 0, "CADocumentController"); qmlRegisterType<CACanvasItem> ("CalligraActive", 1, 0, "CACanvasItem"); qmlRegisterUncreatableType<CAPADocumentModel> ("CalligraActive", 1, 0, "CAPADocumentModel", "Not allowed"); qmlRegisterUncreatableType<CATextDocumentModel> ("CalligraActive", 1, 0, "CATextDocumentModel", "Not allowed"); qmlRegisterInterface<KoCanvasController> ("KoCanvasController"); qmlRegisterUncreatableType<CAAbstractDocumentHandler>("CalligraActive", 1, 0, "CAAbstractDocumentHandler", "Not allowed"); m_view = new QDeclarativeView (this); kdeclarative.setDeclarativeEngine(m_view->engine()); kdeclarative.initialize(); kdeclarative.setupBindings(); QList<QObject*> recentFiles; QList<QObject*> recentTextDocs; QList<QObject*> recentSpreadsheets; QList<QObject*> recentPresentations; QSettings settings; foreach (const QString &string, settings.value ("recentFiles").toStringList()) { CADocumentInfo* docInfo = CADocumentInfo::fromStringList (string.split (QLatin1Char(';'))); recentFiles.append (docInfo); switch (docInfo->type()) { case CADocumentInfo::TextDocument: recentTextDocs.append (docInfo); break; case CADocumentInfo::Spreadsheet: recentSpreadsheets.append (docInfo); break; case CADocumentInfo::Presentation: recentPresentations.append (docInfo); break; default: ; } } foreach (const QString & importPath, KGlobal::dirs()->findDirs ("module", "imports")) { m_view->engine()->addImportPath (importPath); } m_view->rootContext()->setContextProperty("mainwindow", this); m_view->rootContext()->setContextProperty("_calligra_version_string", CALLIGRA_VERSION_STRING); m_view->engine()->addImageProvider(CAImageProvider::identificationString, CAImageProvider::s_imageProvider); m_view->setSource (QUrl::fromLocalFile (CalligraActive::Global::installPrefix() + "/share/calligraactive/qml/Doc.qml")); m_view->setResizeMode (QDeclarativeView::SizeRootObjectToView); connect (m_view, SIGNAL(sceneResized(QSize)), SLOT(adjustWindowSize(QSize))); resize (1024, 768); setCentralWidget (m_view); QTimer::singleShot(0, this, SLOT(checkForAndOpenDocument())); }
bool ViewerWindow::onMessage(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_SIZING: m_sizeIsChanged = true; return false; case WM_NCDESTROY: m_stopped = true; return true; case WM_USER_STOP: SendMessage(m_hWnd, WM_DESTROY, 0, 0); return true; case WM_USER_FS_WARNING: return onFsWarning(); case WM_CLOSE: return onClose(); case WM_DESTROY: return onDestroy(); case WM_CREATE: return onCreate((LPCREATESTRUCT)lParam); case WM_SIZE: return onSize(wParam, lParam); case WM_USER_AUTH_ERROR: return onAuthError(wParam); case WM_USER_ERROR: return onError(); case WM_USER_DISCONNECT: return onDisconnect(); case WM_ACTIVATE: if ((LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) && m_isFullScr) { try { // Registration of keyboard hook. m_winHooks.registerKeyboardHook(this); // Switching off ignoring win key. m_dsktWnd.setWinKeyIgnore(false); } catch (Exception &e) { m_logWriter.error(_T("%s"), e.getMessage()); } } else if (LOWORD(wParam) == WA_INACTIVE && m_isFullScr) { // Unregistration of keyboard hook. m_winHooks.unregisterKeyboardHook(this); // Switching on ignoring win key. m_dsktWnd.setWinKeyIgnore(true); } return true; case WM_SETFOCUS: return onFocus(wParam); case WM_ERASEBKGND: return onEraseBackground((HDC)wParam); case WM_KILLFOCUS: return onKillFocus(wParam); case WM_TIMER: return onTimer(wParam); case WM_DISPLAYCHANGE: adjustWindowSize(); } return false; }
HWND SoSimple::createMainWindow(WNDPROC nWindowFunc) { TCHAR appName[256], className[256]; _tcscpy(className, CHAR_TO_NATIVE(gClassName.getString())); _tcscpy(appName, CHAR_TO_NATIVE(gAppName.getString())); HINSTANCE hInstance = ::GetModuleHandle(0); WNDCLASS windowclass; windowclass.lpszClassName = className; windowclass.hInstance = hInstance; windowclass.lpfnWndProc = nWindowFunc; windowclass.style = 0; windowclass.lpszMenuName = NULL; windowclass.hIcon = NULL; windowclass.hCursor = NULL; windowclass.hbrBackground = NULL; windowclass.cbClsExtra = 0; windowclass.cbWndExtra = 4; ATOM reg = ::RegisterClass(&windowclass); #ifdef _WIN32_WCE DWORD style = WS_VISIBLE, // | WS_POPUP exStyle = WS_EX_TOPMOST; int width = ::GetSystemMetrics(SM_CXSCREEN), height = ::GetSystemMetrics(SM_CYSCREEN); #else DWORD style = WS_CAPTION | WS_BORDER | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_POPUPWINDOW, exStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; int width = 640, height = 480; #endif adjustWindowSize(width,height, style, exStyle); gHWND = ::CreateWindowEx(exStyle, className, appName, style, CW_USEDEFAULT, CW_USEDEFAULT, width,height, NULL, NULL, hInstance, NULL); if(gHWND==NULL) { DWORD err = ::GetLastError(); err = err; } else { ::ShowWindow(gHWND, SW_SHOW); ::SetForegroundWindow(gHWND); ::InvalidateRect(gHWND, NULL, TRUE); ::UpdateWindow(gHWND); ::Sleep(200); } return gHWND; }