void PreviewWidget::mouseMoveEvent(QMouseEvent *e) { int pos = e->x() / (width() / numCursors); if(pos != current && pos < numCursors) { XDefineCursor(x11Display(), winId(), cursors[pos]->handle()); current = pos; } }
QGLWidget::~QGLWidget() { #if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) bool doRelease = ( glcx && glcx->windowCreated() ); #endif delete glcx; #if defined(Q_WGL) delete olcx; #endif #if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) if ( doRelease ) glXReleaseBuffersMESA( x11Display(), winId() ); #endif }
//===================================== // XAccessX init page with data infos //------------------------------------- void XAccessX::initPage (void) { // log (L_INFO,"XAccessX::initPage() called\n"); // ... // this function is called after the page was created. // It must only be used to init the widgets contents // with the data available for selections and other stuff // like that // --- // Query XKB Extension... // ----------------------- int timeout = 5; major = XkbMajorVersion; minor = XkbMinorVersion; if (XkbQueryExtension( x11Display(), &op, &event, &error, &major, &minor) == 0 ) { log(L_WARN, "XKB: Unable to initialize XKEYBOARD extension\n" ); } while (timeout > 0) { xkb = XkbGetKeyboard( x11Display(), XkbGBN_AllComponentsMask, XkbUseCoreKbd ); if (xkb == NULL || xkb->geom == NULL) { timeout -= 1; sleep(1); } else { break; } } if (timeout <= 0) { log (L_WARN, "XKB: Couldn't get keyboard\n" ); } }
//--------------------------------------------------------------------------- // // Set the pixmap to display // void AmorWidget::setPixmap(const TQPixmap *pixmap) { mPixmap = pixmap; if (mPixmap) { if (mPixmap->mask()) { XShapeCombineMask( x11Display(), winId(), ShapeBounding, 0, 0, mPixmap->mask()->handle(), ShapeSet ); repaint(false); } update(); } }
//===================================== // XAccessX slotIntro... //------------------------------------- void XAccessX::slotIntro (int index) { if (index == mIndex) { XWrapPointer< QDict<char> > mText (mTextPtr); XTextBrowser* info; QString message; QString idents; bool active = FALSE; info = mIntro -> getTextView(); message = mText["accessx_header"]; XkbGetControls(x11Display(), XkbAllControlsMask, xkb); if (xkb->ctrls == NULL) { active = FALSE; } else { if (xkb->ctrls->enabled_ctrls == XACCESS_CODE) { active = TRUE; } else { active = FALSE; } } // begin table message += "<br><br><table border=1 bgcolor=lightgrey "; message += "cellspacing=1 width=90%>"; message += idents; // first row message += "<tr>"; if (active) { QTextOStream (&idents) <<"<td width=200>"<< mText["xaccess"] <<" "<< mText["on"] <<"</td>"; } else { QTextOStream (&idents) <<"<td width=200>"<< mText["xaccess"] <<" "<< mText["off"] <<"</td>"; } message += idents; message += "</tr>"; // end table... message += "</table>"; info -> setText (message); } }
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() ); }
void KuickShow::initImlibParams( ImData *idata, ImlibInitParams *par ) { par->flags = ( PARAMS_REMAP | PARAMS_VISUALID | PARAMS_SHAREDMEM | PARAMS_SHAREDPIXMAPS | PARAMS_FASTRENDER | PARAMS_HIQUALITY | PARAMS_DITHER | PARAMS_IMAGECACHESIZE | PARAMS_PIXMAPCACHESIZE ); Visual* defaultvis = DefaultVisual(x11Display(), x11Screen()); par->paletteoverride = idata->ownPalette ? 1 : 0; par->remap = idata->fastRemap ? 1 : 0; par->fastrender = idata->fastRender ? 1 : 0; par->hiquality = idata->dither16bit ? 1 : 0; par->dither = idata->dither8bit ? 1 : 0; par->sharedmem = 1; par->sharedpixmaps = 1; par->visualid = defaultvis->visualid; uint maxcache = idata->maxCache; // 0 == no cache par->imagecachesize = maxcache * 1024; par->pixmapcachesize = maxcache * 1024; }
//===================================== // XAccessX slotRun... //------------------------------------- bool XAccessX::slotRun (int index) { if (XTemplate::slotRun (index)) { // log(L_INFO,"XAccessX::slotRun() called: %d\n",index); // ... // this function is called if the xaccess page is activated. // use this function to init the dialog with the current // setup of the accessx status information // --- XWrapPointer< QDict<char> > mText (mTextPtr); mStatus -> message (mText["RunXAccess"]); mFrame -> nextButton() -> setText (mText["finish"]); // ... // if AccessX is active we will set the current speed // value here otherwhise the slider is disabled // --- XkbGetControls(x11Display(), XkbAllControlsMask, xkb); if (xkb->ctrls == NULL) { xkb->ctrls = (XkbControlsPtr)malloc(sizeof(XkbControlsRec)); isActive = FALSE; } else { if (XACCESS_CODE(xkb)) { isActive = TRUE; } else { isActive = FALSE; } } if (isActive) { slotState (true); mEnable -> setChecked ( true ); mSpeed -> setValue ( xkb->ctrls->mk_max_speed ); } else { mEnable -> setChecked ( false ); mDisable -> setChecked ( true ); slotState (false); } } return (TRUE); }
DockWnd::DockWnd(QWidget *main) : QWidget(NULL, "dock", WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop) { setMouseTracking(true); connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow())); connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showDockPopup(QPoint))); connect(this, SIGNAL(doubleClicked()), main, SLOT(dockDblClicked())); connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*))); connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset())); connect(pMain, SIGNAL(msgChanged()), this, SLOT(reset())); m_state = 0; showIcon = State; QTimer *t = new QTimer(this); connect(t, SIGNAL(timeout()), this, SLOT(timer())); t->start(800); bNoToggle = false; #ifdef WIN32 QWidget::hide(); QWidget::setIcon(Pict(pClient->getStatusIcon())); gDock = this; oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc); if (oldDockProc == 0) oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc); NOTIFYICONDATAA notifyIconData; notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.szTip[0] = 0; notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; notifyIconData.uID = 0; Shell_NotifyIconA(NIM_ADD, ¬ifyIconData); #else setMinimumSize(22, 22); resize(22, 22); bInit = false; inTray = false; inNetTray = false; Display *dsp = x11Display(); WId win = winId(); if (bEnlightenment){ wharfIcon = NULL; bInit = true; resize(48, 48); setFocusPolicy(NoFocus); move(pMain->getDockX(), pMain->getDockY()); reset(); MWMHints mwm; mwm.flags = MWM_HINTS_DECORATIONS; mwm.functions = 0; mwm.decorations = 0; mwm.inputMode = 0; mwm.status = 0; Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False); XChangeProperty(dsp, win, a, a, 32, PropModeReplace, (unsigned char *)&mwm, sizeof(MWMHints) / 4); XStoreName(dsp, win, "SIM"); XClassHint *xch = XAllocClassHint(); xch->res_name = (char*)"SIM"; xch->res_class = (char*)"Epplet"; XSetClassHint(dsp, win, xch); XFree(xch); XSetIconName(dsp, win, "SIM"); unsigned long val = (1 << 0) /* | (1 << 9) */ ; a = XInternAtom(dsp, "_WIN_STATE", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = 2; a = XInternAtom(dsp, "_WIN_LAYER", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5); a = XInternAtom(dsp, "_WIN_HINTS", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); win_name = "SIM"; win_version = VERSION; win_info = ""; while (!comms_win) { ECommsSetup(dsp); sleep(1); } char s[256]; snprintf(s, sizeof(s), "set clientname %s", win_name); ECommsSend(s); snprintf(s, sizeof(s), "set version %s", win_version); ECommsSend(s); snprintf(s, sizeof(s), "set info %s", win_info); ECommsSend(s); ESYNC; set_background_properties(this); show(); return; } wharfIcon = new WharfIcon(this); setBackgroundMode(X11ParentRelative); const QPixmap &pict = Pict(pClient->getStatusIcon()); setIcon(pict); XClassHint classhint; classhint.res_name = (char*)"sim"; classhint.res_class = (char*)"Wharf"; XSetClassHint(dsp, win, &classhint); Screen *screen = XDefaultScreenOfDisplay(dsp); int screen_id = XScreenNumberOfScreen(screen); char buf[32]; snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id); Atom selection_atom = XInternAtom(dsp, buf, false); XGrabServer(dsp); Window manager_window = XGetSelectionOwner(dsp, selection_atom); if (manager_window != None) XSelectInput(dsp, manager_window, StructureNotifyMask); XUngrabServer(dsp); XFlush(dsp); if (manager_window != None){ inNetTray = true; if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){ inNetTray = false; } } Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false); long data[1]; data[0] = 0; XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW, 32, PropModeReplace, (unsigned char*)data, 1); XWMHints *hints; hints = XGetWMHints(dsp, win); hints->initial_state = WithdrawnState; hints->icon_x = 0; hints->icon_y = 0; hints->icon_window = wharfIcon->winId(); hints->window_group = win; hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint; XSetWMHints(dsp, win, hints); XFree( hints ); XSetCommand(dsp, win, _argv, _argc); if (!inNetTray){ move(-21, -21); resize(22, 22); } show(); #endif reset(); }
//===================================== // XBox set input focus if enterd //------------------------------------- void XBox::enterEvent ( QEvent * ) { XSetInputFocus ( x11Display(),winId(),RevertToParent,CurrentTime ); }
DockWnd::DockWnd(DockPlugin *plugin, const char *icon, const char *text) : QWidget(NULL, "dock", WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop), EventReceiver(LowPriority) { #ifndef WIN32 #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) wharfIcon = NULL; #endif #endif m_plugin = plugin; setMouseTracking(true); bNoToggle = false; bBlink = false; m_state = icon; blinkTimer = new QTimer(this); connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blink())); #ifdef WIN32 m_bBalloon = false; hShell = NULL; setIcon(icon); QWidget::hide(); gDock = this; WM_DOCK = RegisterWindowMessageA("SIM dock"); if (IsWindowUnicode(winId())){ oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc); /* OSVERSIONINFOA osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionExA(&osvi); if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion > 4)) m_bBalloon = true; */ __NOTIFYICONDATAW notifyIconData; if (m_bBalloon){ memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.uVersion = NOTIFYICON_VERSION; Shell_NotifyIconW(NIM_SETVERSION, (NOTIFYICONDATAW*)¬ifyIconData); } memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIconW(NIM_ADD, (NOTIFYICONDATAW*)¬ifyIconData); }else{ oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc); __NOTIFYICONDATAA notifyIconData; memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIconA(NIM_ADD, (NOTIFYICONDATAA*)¬ifyIconData); } #else setMinimumSize(22, 22); resize(22, 22); #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) bInit = false; inTray = false; inNetTray = false; Display *dsp = x11Display(); WId win = winId(); bool bEnlightenment = false; QWidget tmp; Atom enlightenment_desktop = XInternAtom(dsp, "ENLIGHTENMENT_DESKTOP", false); WId w = tmp.winId(); Window p, r; Window *c; unsigned int nc; while (XQueryTree(dsp, w, &r, &p, &c, &nc)){ if (c && nc > 0) XFree(c); if (! p) { log(L_WARN, "No parent"); break; } unsigned char *data_ret = NULL; Atom type_ret; int i_unused; unsigned long l_unused; if ((XGetWindowProperty(dsp, p, enlightenment_desktop, 0, 1, False, XA_CARDINAL, &type_ret, &i_unused, &l_unused, &l_unused, &data_ret) == Success) && (type_ret == XA_CARDINAL)) { if (data_ret) XFree(data_ret); bEnlightenment = true; log(L_DEBUG, "Detect Enlightenment"); break; } if (p == r) break; w = p; } if (bEnlightenment){ bInit = true; resize(48, 48); setFocusPolicy(NoFocus); move(m_plugin->getDockX(), m_plugin->getDockY()); MWMHints mwm; mwm.flags = MWM_HINTS_DECORATIONS; mwm.functions = 0; mwm.decorations = 0; mwm.inputMode = 0; mwm.status = 0; Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False); XChangeProperty(dsp, win, a, a, 32, PropModeReplace, (unsigned char *)&mwm, sizeof(MWMHints) / 4); XStoreName(dsp, win, "SIM"); XClassHint *xch = XAllocClassHint(); xch->res_name = (char*)"SIM"; xch->res_class = (char*)"Epplet"; XSetClassHint(dsp, win, xch); XFree(xch); XSetIconName(dsp, win, "SIM"); unsigned long val = (1 << 0) /* | (1 << 9) */ ; a = XInternAtom(dsp, "_WIN_STATE", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = 2; a = XInternAtom(dsp, "_WIN_LAYER", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5); a = XInternAtom(dsp, "_WIN_HINTS", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); win_name = "SIM"; win_version = VERSION; win_info = ""; while (!comms_win) { ECommsSetup(dsp); sleep(1); } char s[256]; snprintf(s, sizeof(s), "set clientname %s", win_name); ECommsSend(s); snprintf(s, sizeof(s), "set version %s", win_version); ECommsSend(s); snprintf(s, sizeof(s), "set info %s", win_info); ECommsSend(s); ESYNC; set_background_properties(this); setIcon(icon); show(); return; } wharfIcon = new WharfIcon(this); #endif setBackgroundMode(X11ParentRelative); setIcon(icon); #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) XClassHint classhint; classhint.res_name = (char*)"sim"; classhint.res_class = (char*)"Wharf"; XSetClassHint(dsp, win, &classhint); Screen *screen = XDefaultScreenOfDisplay(dsp); int screen_id = XScreenNumberOfScreen(screen); char buf[32]; snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id); Atom selection_atom = XInternAtom(dsp, buf, false); XGrabServer(dsp); Window manager_window = XGetSelectionOwner(dsp, selection_atom); if (manager_window != None) XSelectInput(dsp, manager_window, StructureNotifyMask); XUngrabServer(dsp); XFlush(dsp); if (manager_window != None){ inNetTray = true; if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){ inNetTray = false; } } Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false); long data[1]; data[0] = 0; XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW, 32, PropModeReplace, (unsigned char*)data, 1); XWMHints *hints; hints = XGetWMHints(dsp, win); hints->initial_state = WithdrawnState; hints->icon_x = 0; hints->icon_y = 0; hints->icon_window = wharfIcon->winId(); hints->window_group = win; hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint; XSetWMHints(dsp, win, hints); XFree( hints ); Event eArgc(EventArgc); int argc = (int)eArgc.process(); Event eArgv(EventArgv); char **argv = (char**)eArgv.process(); XSetCommand(dsp, win, argv, argc); if (!inNetTray){ move(-21, -21); resize(22, 22); } #endif show(); #endif setTip(text); reset(); }
Korn::Korn(QWidget *parent, KornSettings *settings, WFlags f) : QFrame(parent, "korn", f) { int count=0; KornButton *button; QBoxLayout::Direction dir= QBoxLayout::TopToBottom; _optionsDialog = 0; _noConfig = false; // popup menu menu = new QPopupMenu(); menu->insertItem(i18n("&Setup"), this, SLOT( optionDlg() )); menu->insertSeparator(); menu->insertItem(i18n("&Help"), this, SLOT( help() )); menu->insertItem(i18n("&About"), this, SLOT( about() )); menu->insertSeparator(); menu->insertItem(i18n("E&xit"), qApp, SLOT( quit() )); // widget decorations if(settings->layout() == KornSettings::horizontal ) dir = QBoxLayout::LeftToRight; QBoxLayout *layout = new QBoxLayout(this, dir, 2); setFrameStyle(Panel | Raised); setLineWidth(1); // read settings and create boxes options = new QList<KornBox>; options->setAutoDelete( true ); while( !settings->done() ) { // create a new button with these settings button = new KornButton(this, settings); button->resize(20,20); layout->addWidget(button); connect( button, SIGNAL( rightClick() ), this, SLOT( popupMenu() )); button->show(); /// keep track of settings locally KornBox *thisBox = new KornBox; thisBox->name = settings->name().data(); thisBox->caption = settings->caption().data(); thisBox->path = settings->file().data(); thisBox->poll = settings->pollTime(); thisBox->notify = settings->audioCmd().data(); thisBox->click = settings->clickCmd().data(); options->append( thisBox ); count++; settings->nextBox(); } // dont layout or resize if no buttons were created // This should be changed, perhaps to a default single button if( !settings->valid() || count == 0 ) { // no valid config _noConfig = true; int result = KMsgBox::yesNo(0, i18n("korn: configure now?"), i18n("you have not yet configured korn.\n" "would you like to do this now?"), KMsgBox::QUESTION, i18n("Yes"), i18n("No - Quit")); if( result == 1 ) { // create a list with the default mailbox in it. KornBox *box = new KornBox; box->name = i18n("personal"); box->caption = i18n("Inbox"); box->path = (const char *)getenv("MAIL"); box->poll = 240; options->append( box ); optionDlg(); } else { qApp->quit(); } return; } if( dir == QBoxLayout::LeftToRight ) resize(count*(2+20)+2,4+20); else resize(4+20, count*(2+20)+2); // move to the saved position if a position was saved if( settings->geomSet() ) { setGeometry( settings->geom().x(), settings->geom().y(), width(), height() ); } else { // save position KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup("Korn"); config->writeEntry("PosX", frameGeometry().x(), true); config->writeEntry("PosY", frameGeometry().y(), true); config->writeEntry("winHeight", frameGeometry().height(), true); } if( settings->noMouse() ) { XSelectInput( x11Display(), handle(), ExposureMask | StructureNotifyMask ); } }
DockWnd::DockWnd(QWidget *main) : QWidget(NULL) { #ifndef WIN32 wharfIcon = NULL; #endif connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow())); connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showPopup(QPoint))); connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*))); connect(pClient, SIGNAL(messageRead(ICQMessage*)), this, SLOT(messageRead(ICQMessage*))); connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*))); connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset())); m_state = 0; showIcon = State; QTimer *t = new QTimer(this); connect(t, SIGNAL(timeout()), this, SLOT(timer())); t->start(800); bool bWMDock = false; #ifndef WIN32 Atom r_type; int r_format; unsigned long count, bytes_remain; unsigned char *prop = NULL, *prop2 = NULL; Atom _XA_WIN_SUPPORTING_WM_CHECK = XInternAtom(qt_xdisplay(), XA_WIN_SUPPORTING_WM_CHECK, False); int p = XGetWindowProperty(qt_xdisplay(), qt_xrootwin(), _XA_WIN_SUPPORTING_WM_CHECK, 0, 1, False, XA_CARDINAL, &r_type, &r_format, &count, &bytes_remain, &prop); if (p == Success && prop && r_type == XA_CARDINAL && r_format == 32 && count == 1) { Window n = *(long *) prop; p = XGetWindowProperty(qt_xdisplay(), n, _XA_WIN_SUPPORTING_WM_CHECK, 0, 1, False, XA_CARDINAL, &r_type, &r_format, &count, &bytes_remain, &prop2); if (p == Success && prop2 && r_type == XA_CARDINAL && r_format == 32 && count == 1) bWMDock = true; } if (prop) XFree(prop); if (prop2) XFree(prop2); #endif #ifdef USE_KDE log(L_DEBUG, "WM props? %u", bWMDock); if (!bWMDock) KWin::setSystemTrayWindowFor( winId(), main->topLevelWidget()->winId()); #endif needToggle = false; #ifdef WIN32 QWidget::hide(); QWidget::setIcon(Pict(pClient->getStatusIcon())); gDock = this; oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc); if (oldDockProc == 0) oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc); NOTIFYICONDATAA notifyIconData; notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.szTip[0] = 0; notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; notifyIconData.uID = 0; Shell_NotifyIconA(NIM_ADD, ¬ifyIconData); #else if (!bWMDock){ setBackgroundMode(X11ParentRelative); setIcon(Pict(pClient->getStatusIcon())); #ifdef USE_KDE show(); #else hide(); #endif }else{ wharfIcon = new WharfIcon(this); Display *dsp = x11Display(); WId win = winId(); XWMHints *hints; XClassHint classhint; classhint.res_name = (char*)"sim"; classhint.res_class = (char*)"sim"; XSetClassHint(dsp, win, &classhint); hints = XGetWMHints(dsp, win); hints->initial_state = WithdrawnState; hints->icon_x = 0; hints->icon_y = 0; hints->icon_window = wharfIcon->winId(); hints->window_group = win; hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint; XSetWMHints(dsp, win, hints); XFree( hints ); XSetCommand(dsp, winId(), _argv, _argc); resize(64, 64); show(); } #endif loadUnread(); reset(); }