Exemple #1
0
void QWidget::setMask( const QRegion& region )
{
    createExtra();

    if ( region == extra->mask )
	return;

    alloc_region_dirty = TRUE;

    extra->mask = region;

    if ( isTopLevel() ) {
	if ( !region.isNull() ) {
	    req_region = extra->mask;
	    req_region.translate(crect.x(),crect.y()); //###expensive?
	    req_region &= crect; //??? this is optional
	} else
	    req_region = QRegion(crect);
	req_region = qt_screen->mapToDevice( req_region, QSize(qt_screen->width(), qt_screen->height()) );
    }
    if ( isVisible() ) {
	if ( isTopLevel() ) {
	    QRegion rgn( req_region );
#ifndef QT_NO_QWS_MANAGER
	    if ( extra && extra->topextra && extra->topextra->qwsManager ) {
		QRegion wmr = extra->topextra->qwsManager->region();
		wmr = qt_screen->mapToDevice( wmr, QSize(qt_screen->width(), qt_screen->height()) );
		rgn += wmr;
	    }
#endif
	    qwsDisplay()->requestRegion(winId(), rgn);
	} else {
	    updateRequestedRegion( mapToGlobal(QPoint(0,0)) );
	    parentWidget()->paintable_region_dirty = TRUE;
	    parentWidget()->repaint(geometry());
	    paint_children( parentWidget(),geometry(),TRUE );
	}
    }
}
Exemple #2
0
/*!
  For internal use only.
*/
void QNPWidget::setWindow(bool delold)
{
    saveWId = winId(); // ### Don't need this anymore

    create((WId)pi->window, FALSE, delold);

   if ( delold ) {
      // Make sure they get a show()
      clearWFlags( WState_Visible );
   }

#ifdef _WS_X11_
    Widget w = XtWindowToWidget (qt_xdisplay(), pi->window);
    XtAddEventHandler(w, EnterWindowMask, FALSE, enter_event_handler, pi);
    XtAddEventHandler(w, LeaveWindowMask, FALSE, leave_event_handler, pi);
    Pixmap bgpm=0;
    XColor col;
    XtVaGetValues(w,
	XtNbackground, &col.pixel,
	XtNbackgroundPixmap, &bgpm,
	0, 0);
    XQueryColor(qt_xdisplay(), x11Colormap(), &col);
    setBackgroundColor(QColor(col.red >> 8, col.green >> 8, col.blue >> 8));
    if (bgpm) {
	// ### Need an under-the-hood function here, or we have to
	// ### rewrite lots of code from QPixmap::convertToImage().
	// ### Doesn't matter yet, because Netscape doesn't ever set
	// ### the background image of the window it gives us.
    }
#endif

    createNewWindowsForAllChildren(this);

//#ifdef _WS_WIN_
    //setGeometry( pi->x, pi->y, pi->width, pi->height );
//#else
    resize( pi->width, pi->height );
//#endif
}
void QWSYellowSurface::flush(QWidget *widget, const QRegion &region,
                             const QPoint &offset)
{
    Q_UNUSED(offset);

    QWSDisplay *display = QWidget::qwsDisplay();
    QRegion rgn = region;

    if (widget)
        rgn.translate(widget->mapToGlobal(QPoint(0, 0)));

    surfaceSize = region.boundingRect().size();

    const int id = winId();
    display->requestRegion(id, key(), permanentState(), rgn);
    display->setAltitude(id, 1, true);
    display->repaintRegion(id, 0, false, rgn);

    ::usleep(500 * delay);
    display->requestRegion(id, key(), permanentState(), QRegion());
    ::usleep(500 * delay);
}
void ImageshackWindow::readSettings()
{
    winId();
    KConfig config(QString::fromLatin1("kipirc"));
    KConfigGroup group = config.group("Imageshack Settings");
    KWindowConfig::restoreWindowSize(windowHandle(), group);
    resize(windowHandle()->size());

    if (group.readEntry("Private", false))
    {
        m_widget->m_privateImagesChb->setChecked(true);
    }

    if (group.readEntry("Rembar", false))
    {
        m_widget->m_remBarChb->setChecked(true);
    }
    else
    {
        m_widget->m_remBarChb->setChecked(false);
    }
}
Exemple #5
0
void OSDWidget::reposition( QSize newSize ) {
	if( !newSize.isValid() ) newSize = size();

	QPoint newPos( MARGIN, m_y );
	const QRect screen = QApplication::desktop()->screenGeometry( m_screen );

	//TODO m_y is the middle of the OSD, and don't exceed screen margins

	switch ( m_alignment ) {
	case Left:
		break;

	case Right:
		newPos.rx() = screen.width() - MARGIN - newSize.width();
		break;

	case Center:
		newPos.ry() = (screen.height() - newSize.height()) / 2;

		//FALL THROUGH

	case Middle:
		newPos.rx() = (screen.width() - newSize.width()) / 2;
		break;
	}

	//ensure we don't dip below the screen
	if( newPos.y()+newSize.height() > screen.height()-MARGIN ) newPos.ry() = screen.height()-MARGIN-newSize.height();

	// correct for screen position
	newPos += screen.topLeft();

	//ensure we are painted before we move
	if( isVisible() ) paintEvent( 0 );

	//fancy X11 move+resize, reduces visual artifacts
	XMoveResizeWindow( x11Display(), winId(), newPos.x(), newPos.y(), newSize.width(), newSize.height() );
}
Exemple #6
0
	void MainWindow::initSettings()
	{
        auto main_rect = Ui::get_gui_settings()->get_value<QRect>(
            settings_main_window_rect,
            QRect(0, 0, Utils::scale_value(1000), Utils::scale_value(600)));

		resize(main_rect.width(), main_rect.height());
		setMinimumHeight(Utils::scale_value(550));
		setMinimumWidth(Utils::scale_value(700));

        if (main_rect.left() == 0 && main_rect.top() == 0)
		{
			QRect rc = main_rect;

            QRect desktopRect = QDesktopWidget().availableGeometry(this);

            QPoint center = desktopRect.center();

			move(center.x() - width()*0.5, center.y()-height()*0.5);

            get_gui_settings()->set_value(settings_main_window_rect, geometry());
		}
        else
        {
            move(main_rect.left(), main_rect.top());
        }

        bool isMaximized = get_gui_settings()->get_value<bool>(settings_window_maximized, false);
		isMaximized ? showMaximized() : show();
        maximize_button_->setProperty("MinimizeButton", isMaximized);
        maximize_button_->setProperty("MaximizeButton", !isMaximized);
        maximize_button_->setStyle(QApplication::style());

#ifdef _WIN32
        if (isMaximized)
            SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
#endif //_WIN32
	}
Exemple #7
0
// This base stuff is required by both FreeDesktop specification and WindowMaker
void TrayIcon::TrayIconPrivate::initWM(WId icon)
{
	Display *dsp = QX11Info::display();
	WId leader   = winId();

	// set the class hint
	XClassHint classhint;
	classhint.res_name  = (char*)"wpdock";
	classhint.res_class = (char*)"Wolfpack";
	XSetClassHint(dsp, leader, &classhint);

	// set the Window Manager hints
	XWMHints *hints;
	hints = XGetWMHints(dsp, leader);	// init hints
	hints->flags = WindowGroupHint | IconWindowHint | StateHint;	// set the window group hint
	hints->window_group = leader;		// set the window hint
	hints->initial_state = WithdrawnState;	// initial state
	hints->icon_window = icon;		// in WM, this should be winId() of separate widget
	hints->icon_x = 0;
	hints->icon_y = 0;
	XSetWMHints(dsp, leader, hints);	// set the window hints for WM to use.
	XFree( hints );
}
Exemple #8
0
DatePicker::DatePicker(QWidget *parent, const QDate &date, Prefs *_prefs)
    : QVBox(parent, 0, _prefs->calendarFullWindow() ? (WType_TopLevel | WDestructiveClose | WStyle_StaysOnTop)
                                                    : (WStyle_Customize | WStyle_NoBorder | WType_TopLevel | WDestructiveClose | WStyle_StaysOnTop))
    , prefs(_prefs)
{
    if(prefs->calendarFullWindow())
    {
        KWin::setType(winId(), NET::Utility);
        setFrameStyle(QFrame::NoFrame);
    }
    else
    {
        setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
    }

    KWin::setOnAllDesktops(handle(), true);
    picker = new KDatePicker(this, date);
    picker->setCloseButton(!_prefs->calendarFullWindow());

    /* name and icon for kicker's taskbar */
    setCaption(i18n("Calendar"));
    setIcon(SmallIcon("date"));
}
Exemple #9
0
QString VdpauWidget::initVdpau()
{
   QString res = vc->init();
   if ( !res.isEmpty() )
      return res;

   VdpStatus st = vc->vdp_output_surface_create( vc->vdpDevice, VDP_RGBA_FORMAT_B8G8R8A8, width(), height(), &displaySurface );
   if ( st != VDP_STATUS_OK ) {
      return "FATAL: Can't create display output surface !!\n";
   }

   if ( !createMixer( SURFACEWIDTH, SURFACEHEIGHT ) )
      return "FATAL: can't create mixer!\n";

   st = vc->vdp_presentation_queue_target_create_x11( vc->vdpDevice, winId(), &queueTarget );
   if ( st != VDP_STATUS_OK )
      return "FATAL: can't create queue target!";
   st = vc->vdp_presentation_queue_create( vc->vdpDevice, queueTarget, &queue );
   if ( st != VDP_STATUS_OK )
      return "FATAL: can't create display queue!";

   return "";
}
Exemple #10
0
void
PodcastSettingsDialog::init()
{
        m_ps = new PodcastSettingsDialogBase(this);

        KWin::setState( winId(), NET::SkipTaskbar );

        setMainWidget(m_ps);
        m_ps->m_saveLocation->setMode( KFile::Directory | KFile::ExistingOnly );

        m_ps->m_addToMediaDeviceCheck->setEnabled( MediaBrowser::isAvailable() );

        enableButtonOK( false );

         // Connects for modification check
        connect( m_ps->m_purgeCountSpinBox->child( "qt_spinbox_edit" ),  SIGNAL(textChanged( const QString& )), SLOT(checkModified()) );
        connect( m_ps->m_saveLocation,   SIGNAL(textChanged( const QString& )), SLOT(checkModified()) );
        connect( m_ps->m_autoFetchCheck, SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_streamRadio,    SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_addToMediaDeviceCheck, SIGNAL(clicked()),              SLOT(checkModified()) );
        connect( m_ps->m_downloadRadio,  SIGNAL(clicked()),                     SLOT(checkModified()) );
        connect( m_ps->m_purgeCheck,     SIGNAL(clicked()),                     SLOT(checkModified()) );
}
void Qsfml::showEvent(QShowEvent*){
    if (!myInitialized)
    {
        // Sous X11, il faut valider les commandes qui ont été envoyées au serveur
        // afin de s'assurer que SFML aura une vision à jour de la fenêtre
        #ifdef Q_WS_X11
           XFlush(QX11Info::display());
        #endif

        // On crée la fenêtre SFML avec l'identificateur du widget
        create(winId());

        // On laisse la classe dérivée s'initialiser si besoin
        OnInit();

        // On paramètre le timer de sorte qu'il génère un rafraîchissement à la fréquence souhaitée
        connect(&myTimer, SIGNAL(timeout()), this, SLOT(repaint()));
        myTimer.start();

        myInitialized = true;
    }

}
/*!
    Sends the image that will appear as the window's iconic thumbnail.

    The image should not be larger than 200 by 108 pixels but will be
    scaled down preserving aspect ratio if necessary. To use the Windows
    default iconic thumbnail (an image of the window itself) pass a
    null pixmap.
 */
void IntegratedMainWindow::sendThumbnailInternal()
{
    QPixmap pix = sendThumbnail();
    if (!pix.isNull())
    {
        // If our image is larger than Windows said it could be in winEvent, scale it down
        if (pix.width() > d->m_maxThumbnailSize.width() || pix.height() > d->m_maxThumbnailSize.height())
        {
            pix = pix.scaled(d->m_maxThumbnailSize, Qt::KeepAspectRatio);
        }

        // Assert that our image does not exceed either of Windows' requested maximum dimensions
        Q_ASSERT(pix.width() <= d->m_maxThumbnailSize.width() && pix.height() <= d->m_maxThumbnailSize.height());

        // Convert our pixmap to Windows bitmap and send it to the DWM
        HBITMAP hBitmap = pix.toWinHBITMAP();
        DwmSetIconicThumbnail(winId(), hBitmap, d->m_windowFrameForIconicThumbnails ? DWM_SIT_DISPLAYFRAME : 0);
        if (hBitmap)
        {
            DeleteObject(hBitmap);
        }
    }
}
Exemple #13
0
void QSFMLCanvas::showEvent(QShowEvent*)
{
    if (!myInitialized)
    {
        // Under X11, we need to flush the commands sent to the server to ensure that
        // SFML will get an updated view of the windows
#ifdef Q_WS_X11
        XFlush(QX11Info::display());
#endif

        // Create the SFML window with the widget handle
        sf::RenderWindow::create((sf::WindowHandle) winId());

        // Let the derived class do its specific stuff
        OnInit();

        // Setup the timer to trigger a refresh at specified framerate
        connect(&myTimer, SIGNAL(timeout()), this, SLOT(repaint()));
        myTimer.start();

        myInitialized = true;
    }
}
Exemple #14
0
bool KSharedPixmap::loadFromShared(const QString & name, const QRect & rect)
{
    d->rect = rect;
    if (d->selection != None)
	// already active
	return false;

    QPixmap::resize(0, 0); // invalidate

    QString str = QString("KDESHPIXMAP:%1").arg(name);
    d->selection = XInternAtom(qt_xdisplay(), str.latin1(), true);
    if (d->selection == None)
	return false;
    if (XGetSelectionOwner(qt_xdisplay(), d->selection) == None)
    {
	d->selection = None;
	return false;
    }

    XConvertSelection(qt_xdisplay(), d->selection, d->pixmap, d->target,
	    winId(), CurrentTime);
    return true;
}
Exemple #15
0
void CWizDocumentListView::startDrag(Qt::DropActions supportedActions)
{
    Q_UNUSED(supportedActions);

    CWizStdStringArray arrayGUID;

    QList<QListWidgetItem*> items = selectedItems();
    foreach (QListWidgetItem* it, items) {
        if (CWizDocumentListViewItem* item = dynamic_cast<CWizDocumentListViewItem*>(it)) {
            // not support drag group document currently
            if (item->document().strKbGUID != m_dbMgr.db().kbGUID())
                return;

            arrayGUID.push_back((item->document().strGUID));
        }
    }

    if (arrayGUID.empty())
        return;

    CString strGUIDs;
    ::WizStringArrayToText(arrayGUID, strGUIDs, ";");

    QDrag* drag = new QDrag(this);

    QMimeData* mimeData = new QMimeData();
    mimeData->setData(WIZNOTE_MIMEFORMAT_DOCUMENTS, strGUIDs.toUtf8());
    drag->setMimeData(mimeData);

    // FIXME: need deal with more then 1 drag event!
    if (items.size() == 1) {
        QRect rect = visualItemRect(items[0]);
        drag->setPixmap(QPixmap::grabWindow(winId(), rect.x(), rect.y(), rect.width(), rect.height()));
    }

    drag->exec();
}
Exemple #16
0
KSystemTray::KSystemTray(QWidget *parent, const char *name) : QLabel(parent, name, WType_TopLevel)
{
#ifdef Q_WS_X11
    QXEmbed::initialize();
#endif

    d = new KSystemTrayPrivate;
    d->actionCollection = new KActionCollection(this);

#ifdef Q_WS_X11
    KWin::setSystemTrayWindowFor(winId(), parent ? parent->topLevelWidget()->winId() : qt_xrootwin());
#endif
    setBackgroundMode(X11ParentRelative);
    setBackgroundOrigin(WindowOrigin);
    hasQuit = 0;
    menu = new KPopupMenu(this);
    menu->insertTitle(kapp->miniIcon(), kapp->caption());
    move(-1000, -1000);
    KStdAction::quit(this, SLOT(maybeQuit()), d->actionCollection);

    if(parentWidget())
    {
        new KAction(i18n("Minimize"), KShortcut(), this, SLOT(minimizeRestoreAction()), d->actionCollection, "minimizeRestore");
#ifdef Q_WS_X11
        KWin::WindowInfo info = KWin::windowInfo(parentWidget()->winId());
        d->on_all_desktops = info.onAllDesktops();
#else
        d->on_all_desktops = false;
#endif
    }
    else
    {
        d->on_all_desktops = false;
    }
    setCaption(KGlobal::instance()->aboutData()->programName());
    setAlignment(alignment() | Qt::AlignVCenter | Qt::AlignHCenter);
}
QWSDirectPainterSurface::QWSDirectPainterSurface(bool isClient,
                                                 QDirectPainter::SurfaceFlag flags)
    : QWSWindowSurface(), flushingRegionEvents(false), doLocking(false)
{
    setSurfaceFlags(Opaque);
    synchronous = (flags == QDirectPainter::ReservedSynchronous);

    if (isClient) {
        setWinId(QWidget::qwsDisplay()->takeId());
        QWidget::qwsDisplay()->nameRegion(winId(),
                                          QLatin1String("QDirectPainter reserved space"),
                                          QLatin1String("reserved"));
    } else {
        setWinId(0);
    }
    _screen = QScreen::instance();
    if (!_screen->base()) {
        QList<QScreen*> subScreens = _screen->subScreens();
        if (subScreens.size() < 1)
            _screen = 0;
        else
            _screen = subScreens.at(0);
    }
}
Exemple #18
0
CCefWindow::~CCefWindow()
{
	pQCefViewWidget_ = NULL;

	auto it = instance_map_.find((HWND)winId());
	if (it != instance_map_.end())
	{
		instance_map_.erase(it);
	}

	destroy();
	
	if (hwndCefBrowser_)
	{
		hwndCefBrowser_ = NULL;
	}

	if (pQCefViewHandler)
	{
		pQCefViewHandler = NULL;
	}

	CCefManager::getInstance().ReleaseBrowserRefCount();
}
Exemple #19
0
KWindowSystemPrivate::KWindowSystemPrivate(int _what)
    : QWidget(0),
      NETRootInfo( QX11Info::display(),
                   _what >= KWindowSystem::INFO_WINDOWS ? windows_properties : desktop_properties,
                   2, -1, false ),
      strutSignalConnected( false ),
      haveXfixes( false ),
      what( _what )
{
    KSystemEventFilter::installEventFilter(this);
    (void ) qApp->desktop(); //trigger desktop widget creation to select root window events

#ifdef HAVE_XFIXES
    int errorBase;
    if ((haveXfixes = XFixesQueryExtension(QX11Info::display(), &xfixesEventBase, &errorBase))) {
        create_atoms();
        XFixesSelectSelectionInput(QX11Info::display(), winId(), net_wm_cm,
                                   XFixesSetSelectionOwnerNotifyMask |
                                   XFixesSelectionWindowDestroyNotifyMask |
                                   XFixesSelectionClientCloseNotifyMask);
        compositingEnabled = XGetSelectionOwner(QX11Info::display(), net_wm_cm) != None;
    }
#endif
}
Exemple #20
0
bool xing::init()
{
    if (QLibrary::isLibrary("xingAPI.dll")) {
      lib.setFileName("xingAPI.dll");
      lib.load();
      m_fpConnect = (FP_CONNECT)lib.resolve("ETK_Connect");
      m_fpIsConnected = (FP_ISCONNECTED)lib.resolve("ETK_IsConnected");
      m_fpDisconnect = (FP_DISCONNECT)lib.resolve("ETK_Disconnect");
      m_fpLogin = (FP_LOGIN)lib.resolve("ETK_Login");
      m_fpGetLastError = (FP_GETLASTERROR)lib.resolve("ETK_GetLastError");
      m_fpGetErrorMessage = (FP_GETERRORMESSAGE)lib.resolve("ETK_GetErrorMessage");
      m_fpRequest = (FP_REQUEST)lib.resolve("ETK_Request");
      m_fpAdviseRealData = (FP_ADVISEREALDATA)lib.resolve("ETK_AdviseRealData");
      m_fpUnadviseRealData = (FP_UNADVISEREALDATA)lib.resolve("ETK_UnadviseRealData");
      m_fpUnadviseWindow = (FP_UNADVISEWINDOW)lib.resolve("ETK_UnadviseWindow");
      m_fpReleaseRequestData = (FP_RELEASEREQUESTDATA)lib.resolve("ETK_ReleaseRequestData");
      m_fpGetAccountListCount = (FP_GETACCOUNTLISTCOUNT)lib.resolve("ETK_GetAccountListCount");
      m_fpGetAccountList = (FP_GETACCOUNTLIST)lib.resolve("ETK_GetAccountList");
      m_fpGetCommMedia = (FP_GETCOMMMEDIA)lib.resolve("ETK_GetCommMedia");
      m_fpGetETKMedia = (FP_GETETKMEDIA)lib.resolve("ETK_GetETKMedia");
      m_fpGetClientIP = (FP_GETCLIENTIP)lib.resolve("ETK_GetClientIP");
      m_fpGetServerName = (FP_GETSERVERNAME)lib.resolve("ETK_GetServerName");
      m_fpSetHeaderInfo = (FP_SETHEADERINFO)lib.resolve("ETK_SetHeaderInfo");
      m_fpReleaseMessageData = (FP_RELEASEMESSAGEDATA)lib.resolve("ETK_ReleaseMessageData");
      m_fpRequestService = (FP_REQUESTSERVICE)lib.resolve("ETK_RequestService" );
      if (!lib.isLoaded()) {
        qDebug() << lib.errorString();
        return false;
      }
    }

    //set handler
    set_windid((HWND)winId());

    return true;
}
void ezQtEngineViewWidget::SyncToEngine()
{
  ezViewRedrawMsgToEngine cam;
  cam.m_uiRenderMode = m_pViewConfig->m_RenderMode;
  cam.m_CameraUsageHint = m_pViewConfig->m_CameraUsageHint;

  float fov = m_pViewConfig->m_Camera.GetFovOrDim();
  if (m_pViewConfig->m_Camera.IsPerspective())
  {
    ezEditorPreferencesUser* pPref = ezPreferences::QueryPreferences<ezEditorPreferencesUser>();
    fov = pPref->m_fPerspectiveFieldOfView;
  }

  cam.m_uiViewID = GetViewID();
  cam.m_fNearPlane = m_pViewConfig->m_Camera.GetNearPlane();
  cam.m_fFarPlane = m_pViewConfig->m_Camera.GetFarPlane();
  cam.m_iCameraMode = (ezInt8)m_pViewConfig->m_Camera.GetCameraMode();
  cam.m_bUseCameraTransformOnDevice = m_pViewConfig->m_bUseCameraTransformOnDevice;
  cam.m_fFovOrDim = fov;
  cam.m_vDirForwards = m_pViewConfig->m_Camera.GetCenterDirForwards();
  cam.m_vDirUp = m_pViewConfig->m_Camera.GetCenterDirUp();
  cam.m_vDirRight = m_pViewConfig->m_Camera.GetCenterDirRight();
  cam.m_vPosition = m_pViewConfig->m_Camera.GetCenterPosition();
  cam.m_ViewMatrix = m_pViewConfig->m_Camera.GetViewMatrix();
  m_pViewConfig->m_Camera.GetProjectionMatrix((float)width() / (float)height(), cam.m_ProjMatrix);

  cam.m_uiHWND = (ezUInt64)(winId());
  cam.m_uiWindowWidth = width() * this->devicePixelRatio();
  cam.m_uiWindowHeight = height() * this->devicePixelRatio();
  cam.m_bUpdatePickingData = m_bUpdatePickingData;
  cam.m_bEnablePickingSelected =
      IsPickingAgainstSelectionAllowed() &&
      (!ezEditorInputContext::IsAnyInputContextActive() || ezEditorInputContext::GetActiveInputContext()->IsPickingSelectedAllowed());

  m_pDocumentWindow->GetEditorEngineConnection()->SendMessage(&cam);
}
Exemple #22
0
//---------------------------------------------------------------------------------------------
void TMainForm::MakeDevice()
{
  // Создание объекта Direct3D
  m_pD3D = Direct3DCreate9( D3D_SDK_VERSION);
  if( !m_pD3D )
    BL_FIX_BUG();

  // Создание устройства рендера.
  D3DPRESENT_PARAMETERS d3dpp = {0};
  d3dpp.Windowed = TRUE;
  d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
  d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
  d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  d3dpp.EnableAutoDepthStencil = TRUE;
  d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
  HRESULT hr;
  hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, winId(),
    D3DCREATE_SOFTWARE_VERTEXPROCESSING,
    &d3dpp, &m_pd3dDevice );
  if( FAILED(hr) || !m_pd3dDevice)
    BL_FIX_BUG();
}
Exemple #23
0
bool QSystemTrayIconSys::trayMessage(DWORD msg)
{
    NOTIFYICONDATA tnd;
    memset(&tnd, 0, notifyIconSize);

    tnd.uID = q_uNOTIFYICONID;
    tnd.cbSize = notifyIconSize;
    tnd.hWnd = winId();
    tnd.uFlags = NIF_SHOWTIP;
    tnd.uVersion = version;

    Q_ASSERT(testAttribute(Qt::WA_WState_Created));

    if (msg == NIM_ADD || msg == NIM_MODIFY) {
        setIconContents(tnd);
    }

    bool success = Shell_NotifyIcon(msg, &tnd);

    if (msg == NIM_ADD)
        return success && Shell_NotifyIcon(NIM_SETVERSION, &tnd);
    else
        return success;
}
Exemple #24
0
/*!
  Destructs the KXtWidget.
*/
KXtWidget::~KXtWidget()
{
    // Delete children first, as Xt will destroy their windows
    //
    QObjectList* list = queryList("QWidget", 0, FALSE, FALSE);
    if ( list ) {
        QWidget* c;
        QObjectListIt it( *list );
        while ( (c = (QWidget*)it.current()) ) {
            delete c;
            ++it;
        }
        delete list;
    }

    if ( need_reroot ) {
        hide();
        XReparentWindow(qt_xdisplay(), winId(), qApp->desktop()->winId(),
            x(), y());
    }

    XtDestroyWidget(xtw);
    destroy( FALSE, FALSE );
}
Exemple #25
0
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
    : hIcon(0), q(object), ignoreNextMouseRelease(false)

{
    if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
        notifyIconSize = sizeof(NOTIFYICONDATA);
        version = NOTIFYICON_VERSION_4;
    } else {
        notifyIconSize = NOTIFYICONDATA_V2_SIZE;
        version = NOTIFYICON_VERSION;
    }

    maxTipLength = 128;

    // For restoring the tray icon after explorer crashes
    if (!MYWM_TASKBARCREATED) {
        MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
    }

    // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
    static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
        (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");

    if (pChangeWindowMessageFilterEx) {
        // Call the safer ChangeWindowMessageFilterEx API if available
        pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
    } else {
        static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
            (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");

        if (pChangeWindowMessageFilter) {
            // Call the deprecated ChangeWindowMessageFilter API otherwise
            pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
        }
    }
}
Exemple #26
0
bool DDEWidget::ddeInitiate(MSG* message, long* result)
// ----------------------------------------------------------------------------
//   Process a Windows WM_DDE_INITIATE message
// ----------------------------------------------------------------------------
{
    if ((0 != LOWORD(message->lParam)) &&
            (0 != HIWORD(message->lParam)) &&
            (LOWORD(message->lParam) == appAtom) &&
            (HIWORD(message->lParam) == systemTopicAtom))
    {
        // make duplicates of the incoming atoms (really adding a reference)
        wchar_t atomName[_MAX_PATH];
        bool ok;
        ok = (::GlobalGetAtomNameW(appAtom, atomName, _MAX_PATH-1) != 0);
        XL_ASSERT(ok);
        if (ok)
            ok = (::GlobalAddAtomW(atomName) == appAtom);
        XL_ASSERT(ok);
        if (ok)
            ok = (::GlobalGetAtomNameW(systemTopicAtom, atomName, _MAX_PATH-1)
                  != 0);
        XL_ASSERT(ok);
        if (ok)
            ok = (::GlobalAddAtomW(atomName) == systemTopicAtom);
        XL_ASSERT(ok);

        if (!ok)
            return false;

        // send the WM_DDE_ACK (caller will delete duplicate atoms)
        ::SendMessage((HWND)message->wParam, WM_DDE_ACK, (WPARAM)winId(),
                      MAKELPARAM(appAtom, systemTopicAtom));
    }
    *result = 0;
    return true;
}
KomposeFullscreenWidget::KomposeFullscreenWidget( int displayType, KomposeLayout *l )
    : AbstractViewWidget( 0, l )
{
  //   if ( QT_VERSION < 0x030300 )

  /* use showMaximized instead of setWindowState to make it compile on qt 3.1 or whatever */
  //   showMaximized();
  //   KWin::setState( winId(), NET::KeepAbove );

  // Set Desktop background as our background
  setBackgroundMode( Qt::FixedPixmap );
//   setBackgroundPixmap(*(KomposeGlobal::self()->getDesktopBgPixmap()));
  rootpix = new KRootPixmap (this);
  rootpix->start();
  m_menu = KomposeGlobal::self()->getViewMenu();
  initView();

  // Alternate showFullscreen
  setWindowState(windowState() | WindowFullScreen);

  if (KomposeSettings::self()->viewScreen() == -1)
    setGeometry( KGlobalSettings::desktopGeometry( this ) );
  else
  {
    QDesktopWidget deskwidget;
    QRect deskRect = deskwidget.screenGeometry(KomposeSettings::self()->viewScreen());
    setGeometry(deskRect);
    kdDebug() << deskRect << endl;
  }

  if (!isTopLevel())
    QApplication::sendPostedEvents(this, QEvent::ShowFullScreen);
  setActiveWindow();

  KWin::setOnAllDesktops( winId(), true );
}
Exemple #28
0
void UserBox::wmChanged()
{
#ifdef USE_KDE
    if (pMain->UserWindowInTaskManager()){
        KWin::clearState(winId(), NET::SkipTaskbar);
    }else{
        KWin::setState(winId(), NET::SkipTaskbar);
    }
#endif
#ifdef WIN32
    bool bShow = isVisible();
    hide();
    if (pMain->UserWindowInTaskManager()){
        SetWindowLongW(winId(), GWL_EXSTYLE, (GetWindowLongW(winId(), GWL_EXSTYLE) | WS_EX_APPWINDOW) & (~WS_EX_TOOLWINDOW));
    }else{
        SetWindowLongW(winId(), GWL_EXSTYLE, (GetWindowLongW(winId(), GWL_EXSTYLE) & ~(WS_EX_APPWINDOW)) | WS_EX_TOOLWINDOW);
    }
    if (bShow) show();
#endif
}
bool MainWindow::eventFilter(QObject *o, QEvent *e)
{
#ifdef WIN32
    if (o->inherits("QSizeGrip")){
        QSizeGrip *grip = static_cast<QSizeGrip*>(o);
        QMouseEvent *me;
        switch (e->type()){
        case QEvent::MouseButtonPress:
            me = static_cast<QMouseEvent*>(e);
            p = me->globalPos();
            s = grip->topLevelWidget()->size();
            return true;
        case QEvent::MouseMove:
            me = static_cast<QMouseEvent*>(e);
            if (me->state() != LeftButton)
                break;
            QWidget *tlw = grip->topLevelWidget();
            QRect rc = tlw->geometry();
            if (tlw->testWState(WState_ConfigPending))
                break;
            QPoint np(me->globalPos());
            int w = np.x() - p.x() + s.width();
            int h = np.y() - p.y() + s.height();
            if ( w < 1 )
                w = 1;
            if ( h < 1 )
                h = 1;
            QSize ms(tlw->minimumSizeHint());
            ms = ms.expandedTo(minimumSize());
            if (w < ms.width())
                w = ms.width();
            if (h < ms.height())
                h = ms.height();
            if (!(GetWindowLongA(tlw->winId(), GWL_EXSTYLE) & WS_EX_APPWINDOW)){
                int dc = GetSystemMetrics(SM_CYCAPTION);
                int ds = GetSystemMetrics(SM_CYSMCAPTION);
                tlw->setGeometry(rc.left(), rc.top() + dc - ds, w, h);
            }else{
                tlw->resize(w, h);
            }
            MSG msg;
            while (PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
            return true;
        }
    }
    if (e->type() == QEvent::ChildInserted){
        QChildEvent *ce = static_cast<QChildEvent*>(e);
        if (ce->child()->inherits("QSizeGrip"))
            ce->child()->installEventFilter(this);
    }
#endif
    if (e->type() == QEvent::ChildRemoved){
        QChildEvent *ce = static_cast<QChildEvent*>(e);
        list<QWidget*>::iterator it;
        for (it = statusWidgets.begin(); it != statusWidgets.end(); ++it){
            if (*it == ce->child()){
                statusWidgets.erase(it);
                break;
            }
        }
        if (statusWidgets.size() == 0){
            statusBar()->hide();
            setGrip();
        }
    }
    return QMainWindow::eventFilter(o, e);
}
Exemple #30
0
	bool MainWindow::nativeEventFilter(const QByteArray& data, void *message, long *result)
	{
#ifdef _WIN32
		MSG* msg = (MSG*)(message);
		if (msg->message == WM_NCHITTEST)
		{
			if (msg->hwnd != (HANDLE)winId())
			{
				return false;
			}

			int boxWidth = Utils::scale_value(SIZE_BOX_WIDTH);
			if (isMaximized())
			{
				*result = HTCLIENT;
				return true;
			}

			int x = GET_X_LPARAM(msg->lParam);
			int y = GET_Y_LPARAM(msg->lParam);

			QPoint topLeft = QWidget::mapToGlobal(rect().topLeft());
			QPoint bottomRight = QWidget::mapToGlobal(rect().bottomRight());

			if (x <= topLeft.x() + boxWidth)
			{
				if (y <= topLeft.y() + boxWidth)
					*result = HTTOPLEFT;
				else if (y >= bottomRight.y() - boxWidth)
					*result = HTBOTTOMLEFT;
				else
					*result = HTLEFT;
			}
			else if (x >= bottomRight.x() - boxWidth)
			{
				if (y <= topLeft.y() + boxWidth)
					*result = HTTOPRIGHT;
				else if (y >= bottomRight.y() - boxWidth)
					*result = HTBOTTOMRIGHT;
				else
					*result = HTRIGHT;
			}
			else
			{
				if (y <= topLeft.y() + boxWidth)
					*result = HTTOP;
				else if (y >= bottomRight.y() - boxWidth)
					*result = HTBOTTOM;
				else
					*result = HTCLIENT;
			}
			return true;
		}
		else if ((msg->message == WM_SYSCOMMAND && msg->wParam == SC_RESTORE && msg->hwnd == (HWND)winId()) || (msg->message == WM_SHOWWINDOW && msg->hwnd == (HWND)winId() && msg->wParam == TRUE))
		{
			setVisible(true);
            SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
            tray_icon_->Hide();
            if (!SkipRead_)
			    Logic::GetRecentsModel()->sendLastRead();
            if (!TaskBarIconHidden_)
                SkipRead_ = false;
            TaskBarIconHidden_ = false;
		}
        else if (msg->message == WM_SYSCOMMAND && msg->wParam == SC_CLOSE)
        {
            hideWindow();
            return true;
        }
        else if (msg->message == WM_SYSCOMMAND && msg->wParam  == SC_MINIMIZE)
        {
            minimize();
            return true;
        }
        else if (msg->message == WM_WINDOWPOSCHANGING || msg->message == WM_WINDOWPOSCHANGED)
        {
            if (msg->hwnd != (HANDLE)winId())
            {
                return false;
            }

            WINDOWPOS* pos = (WINDOWPOS*)msg->lParam;
            if (pos->flags == 0x8170 || pos->flags == 0x8130)
            {
                SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW);
                return false;
            }
            if (Shadow_)
            {
                if (!(pos->flags & SWP_NOSIZE) && !(pos->flags & SWP_NOMOVE) && !(pos->flags & SWP_DRAWFRAME))
                {
                    int shadowWidth = get_gui_settings()->get_shadow_width();
                    SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), pos->x - shadowWidth, pos->y - shadowWidth, pos->cx + shadowWidth * 2, pos->cy + shadowWidth * 2, SWP_NOACTIVATE | SWP_NOOWNERZORDER);
                }
                else if (!(pos->flags & SWP_NOZORDER))
                {
                    UINT flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE;
                    if (pos->flags & SWP_SHOWWINDOW)
                        flags |= SWP_SHOWWINDOW;
                    if (pos->flags & SWP_HIDEWINDOW)
                        flags |= SWP_HIDEWINDOW;

                    SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, flags);
                }
            }
        }
        else if (msg->message == WM_ACTIVATE)
        {
            if (!Shadow_)
                return false;

            if (msg->hwnd == (HWND)Shadow_->winId() && msg->wParam != WA_INACTIVE)
            {
                activate();
                return false;
            }
        }
        else if (msg->message == WM_DEVICECHANGE)
        {
            GetSoundsManager()->reinit();
        }
#else

#ifdef __APPLE__
        return MacSupport::nativeEventFilter(data, message, result);
#endif

#endif //_WIN32
		return false;
	}