void KviMainWindow::updatePseudoTransparency() { #ifdef COMPILE_PSEUDO_TRANSPARENCY uint uOpacity = KVI_OPTION_UINT(KviOption_uintGlobalWindowOpacityPercent) < 50 ? 50 : KVI_OPTION_UINT(KviOption_uintGlobalWindowOpacityPercent); setWindowOpacity((float)uOpacity / 100); #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) #ifndef Q_WS_EX_LAYERED #define Q_WS_EX_LAYERED WS_EX_LAYERED #endif if(uOpacity < 100) { SetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE, GetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE) | Q_WS_EX_LAYERED); } else { SetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE, GetWindowLong(reinterpret_cast<HWND>(effectiveWinId()), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED); } #endif if(g_pShadedParentGlobalDesktopBackground) m_pWindowStack->update(); if(g_pShadedChildGlobalDesktopBackground) { for(KviWindow * wnd = m_pWinList->first(); wnd; wnd = m_pWinList->next()) wnd->updateBackgrounds(); m_pWindowList->updatePseudoTransparency(); } #endif }
bool DesktopWindow::event(QEvent* event) { switch(event->type()) { case QEvent::WinIdChange: { qDebug() << "winid change:" << effectiveWinId(); if(effectiveWinId() == 0) { break; } // set freedesktop.org EWMH hints properly if(QX11Info::isPlatformX11() && QX11Info::connection()) { xcb_connection_t* con = QX11Info::connection(); const char* atom_name = "_NET_WM_WINDOW_TYPE_DESKTOP"; xcb_atom_t atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(atom_name), atom_name), nullptr)->atom; const char* prop_atom_name = "_NET_WM_WINDOW_TYPE"; xcb_atom_t prop_atom = xcb_intern_atom_reply(con, xcb_intern_atom(con, 0, strlen(prop_atom_name), prop_atom_name), nullptr)->atom; xcb_atom_t XA_ATOM = 4; xcb_change_property(con, XCB_PROP_MODE_REPLACE, effectiveWinId(), prop_atom, XA_ATOM, 32, 1, &atom); } break; } #undef FontChange // FontChange is defined in the headers of XLib and clashes with Qt, let's undefine it. case QEvent::StyleChange: case QEvent::FontChange: queueRelayout(); break; default: break; } return QWidget::event(event); }
void CWinMain::showOnTop() { #ifdef Q_OS_WIN // THIS IS A HACK: // from QT documentation: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void QWidget::activateWindow () // ... // On Windows, if you are calling this when the application is not currently // the active one then it will not make it the active window. It will change // the color of the taskbar entry to indicate that the window has changed in // some way. This is because Microsoft do not allow an application to // interrupt what the user is currently doing in another application. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // This hack does not give the focus to the app but brings it to front so // the user sees it. SetWindowPos( ( HWND )effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW ); SetWindowPos( ( HWND )effectiveWinId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW ); // HACK END #endif raise(); if ( isMaximized() ) { showMaximized(); } else { showNormal(); } activateWindow(); raise(); }
void MainWindow::show() { QMainWindow::show(); int32_t adapterIndex = 0; m_vrSystem->GetDXGIOutputInfo(&adapterIndex); HWND hWnd = (HWND)effectiveWinId(); m_env = new RenderEnvironment(adapterIndex, hWnd); }
void RazorDeskIconBase::setPos(const QPoint & npos) { qDebug() << "RazorDeskIconBase::setPos"; // if we are in workspace-mode we can move the buttons using Qts move routine if (parent() != NULL) move(npos); else //else we need Xlib for moving, xlib is encapsulated by xfitman from librazorqt. xfitMan().moveWindow(effectiveWinId(), npos.x(), npos.y()); }
void MImRotationAnimation::showEvent(QShowEvent*) { // Setting _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_INPUT // prevents the underlying app from losing focus and // avoid window decorations such as the slide-in animation. static Atom input = XInternAtom(QX11Info::display(), "_NET_WM_WINDOW_TYPE_INPUT", False); static Atom window_type = XInternAtom(QX11Info::display(), "_NET_WM_WINDOW_TYPE", False); XChangeProperty(QX11Info::display(), effectiveWinId(), window_type, XA_ATOM, 32, PropModeReplace, (unsigned char *) &input, 1); }
void EmulatorWindow::slot_getWindowId(WId *out_id, QSemaphore *semaphore) { WId wid = effectiveWinId(); D("Effective win ID is %lx", wid); #if defined(__APPLE__) wid = (WId)getNSWindow((void*)wid); D("After finding parent, win ID is %lx", wid); #endif *out_id = wid; if (semaphore != NULL) semaphore->release(); }
void MainWindow::mountWebDav() { #ifdef Q_OS_WIN char dst[20] = {0}; NETRESOURCEA netres; memset(&netres, 0, sizeof(netres)); netres.dwType = RESOURCETYPE_DISK; netres.lpLocalName = 0; netres.lpRemoteName = webDavUrl.toUtf8().data(); DWORD size = sizeof(dst); DWORD r = WNetUseConnectionA(reinterpret_cast<HWND>(effectiveWinId()), &netres, webDavPassword.toUtf8().constData(), webDavUser.toUtf8().constData(), CONNECT_TEMPORARY | CONNECT_INTERACTIVE | CONNECT_REDIRECT, dst, &size, 0); if (r == NO_ERROR) { passStore = dst; } else { char message[256] = {0}; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, r, 0, message, sizeof(message), 0); ui->textBrowser->setTextColor(Qt::red); ui->textBrowser->setText(tr("Failed to connect WebDAV:\n") + message + " (0x" + QString::number(r, 16) + ")"); } #else fusedav.start("fusedav -o nonempty -u \"" + webDavUser + "\" " + webDavUrl + " \"" + passStore + '"'); fusedav.waitForStarted(); if (fusedav.state() == QProcess::Running) { QString pwd = webDavPassword; bool ok = true; if (pwd.isEmpty()) { pwd = QInputDialog::getText(this, tr("QtPass WebDAV password"), tr("Enter password to connect to WebDAV:"), QLineEdit::Password, "", &ok); } if (ok && !pwd.isEmpty()) { fusedav.write(pwd.toUtf8() + '\n'); fusedav.closeWriteChannel(); fusedav.waitForFinished(2000); } else { fusedav.terminate(); } } QString error = fusedav.readAllStandardError(); int prompt = error.indexOf("Password:"******"fusedav exited unexpectedly\n") + error; } if (error.size() > 0) { ui->textBrowser->setTextColor(Qt::red); ui->textBrowser->setText(tr("Failed to start fusedav to connect WebDAV:\n") + error); } #endif }
PopupView::PopupView(const QModelIndex &index, const QPoint &pos, const bool &showPreview, const QStringList &previewPlugins, const IconView *parentView) : QWidget(0, Qt::X11BypassWindowManagerHint), m_view(0), m_parentView(parentView), m_busyWidget(0), m_iconView(0), m_parentViewModel(0), m_dirModel(0), m_model(0), m_actionCollection(this), m_newMenu(0), m_itemActions(0), m_showingMenu(false), m_showPreview(showPreview), m_delayedClose(false), m_previewPlugins(previewPlugins) { setAttribute(Qt::WA_TranslucentBackground); #ifdef Q_WS_X11 if (KWindowSystem::compositingActive()) { setAttribute(Qt::WA_NoSystemBackground, false); } #endif #ifdef Q_WS_WIN setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); #endif KWindowSystem::setState(effectiveWinId(), NET::SkipTaskbar | NET::SkipPager); setAcceptDrops(true); QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::transparent); pal.setColor(QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); setPalette(pal); m_parentViewModel = static_cast<const ProxyModel*>(index.model()); KFileItem item = m_parentViewModel->itemForIndex(index); if (item.isDesktopFile()) { KDesktopFile file(item.localPath()); m_url = file.readUrl(); } else { m_url = item.targetUrl(); } m_background = new Plasma::FrameSvg(this); m_background->setImagePath("dialogs/background"); int left = m_background->marginSize(Plasma::LeftMargin); int top = m_background->marginSize(Plasma::TopMargin); int right = m_background->marginSize(Plasma::RightMargin); int bottom = m_background->marginSize(Plasma::BottomMargin); setContentsMargins(left, top, right, bottom); resize(parentView->sizeForRowsColumns(2, 3) + QSize(left + right, top + bottom)); const QRect available = QApplication::desktop()->availableGeometry(pos); QPoint pt = pos; if (pt.x() + width() > available.right()) { pt.rx() -= width(); } if (pt.x() < available.left()) { pt.rx() = available.left(); } if (pt.y() + height() > available.bottom()) { pt.ry() -= height(); } if (pt.y() < available.top()) { pt.ry() = available.top(); } Plasma::WindowEffects::overrideShadow(winId(), true); move(pt); show(); QTimer::singleShot(10, this, SLOT(init())); s_lastOpenClose.restart(); }