Пример #1
0
void apbar::place_clients(void)
{
	WINDOW *cur;
	int twidth=2;  // total width

	for(cur = ap.first(); cur != NULL; cur = ap.next())
		twidth += cur->width+4;

	twidth -= 2;
	setUpdatesEnabled(FALSE);
	setFixedWidth(twidth);

	if(! twidth)
	{
		setUpdatesEnabled(TRUE);
		return;
	}	
		
	int cx = 2;
	for(cur = ap.first(); cur != NULL; cur = ap.next())
	{
		XMoveWindow(qt_xdisplay(), cur->w, cx, 0);
		
		XWindowAttributes attr;
		if(XGetWindowAttributes(qt_xdisplay(), cur->w, &attr))
		{
			XMapWindow(qt_xdisplay(), cur->w);
			XRaiseWindow(qt_xdisplay(), cur->w);
		}	
		cx += cur->width+4;
	}
	setUpdatesEnabled(TRUE);
}
Пример #2
0
void getrunprocs(void)  // get already running clients
{
	Window w,w1,w2,*wins;
	uint nwins,cwin;
	XWindowAttributes attr;

	if(XQueryTree(qt_xdisplay(), qt_xrootwin(), &w1, &w2, &wins, &nwins) == 0 || ! nwins)
		return;
	
	bool surgent = defaults::starturgent;
	defaults::starturgent = FALSE;

	for(cwin=0; cwin < nwins; cwin++)
	{
		w = wins[cwin];
		
		if(w == qapp::tb->winId())
			continue;

		XGetWindowAttributes(qt_xdisplay(), w, &attr);

		if(attr.map_state == IsViewable && ! attr.override_redirect)
			qapp::run_client(w);
	}
	XSync(qt_xdisplay(), FALSE);
	defaults::starturgent = surgent;
}
Пример #3
0
    KDE_EXPORT void init_style()
    {
        uint flags = KRdbExportQtSettings | KRdbExportQtColors | KRdbExportXftSettings;
        KConfig config("kcmdisplayrc", true /*readonly*/, false /*don't read kdeglobals etc.*/);
        config.setGroup("X11");

        // This key is written by the "colors" module.
        bool exportKDEColors = config.readBoolEntry("exportKDEColors", true);
        if (exportKDEColors)
            flags |= KRdbExportColors;
        runRdb( flags );

        // Write some Qt root property.
#ifndef __osf__      // this crashes under Tru64 randomly -- will fix later
        QByteArray properties;
        QDataStream d(properties, IO_WriteOnly);
        d.setVersion( 3 );      // Qt2 apps need this.
        d << kapp->palette() << KGlobalSettings::generalFont();
        Atom a = XInternAtom(qt_xdisplay(), "_QT_DESKTOP_PROPERTIES", false);

        // do it for all root windows - multihead support
        int screen_count = ScreenCount(qt_xdisplay());
        for (int i = 0; i < screen_count; i++)
            XChangeProperty(qt_xdisplay(),  RootWindow(qt_xdisplay(), i),
                            a, a, 8, PropModeReplace,
                            (unsigned char*) properties.data(), properties.size());
#endif
    }
Пример #4
0
void KPager::clientPopupActivated( int id )
{
    switch ( id ) {
	case MaximizeOp:
	    if ( (m_winfo.state() & NET::Max)  == 0 ) {
		NETWinInfo ni( qt_xdisplay(),  m_winfo.win(), qt_xrootwin(), 0);
		ni.setState( NET::Max, NET::Max );
	    } else {
		NETWinInfo ni( qt_xdisplay(),  m_winfo.win(), qt_xrootwin(), 0);
		ni.setState( 0, NET::Max );
	    }
	    break;
	case IconifyOp:
	    if ( !m_winfo.isMinimized() ) {
		KWin::iconifyWindow( m_winfo.win());
	    } else {
		KWin::forceActiveWindow( m_winfo.win() );
	    }
	    break;
	case StickyOp:
	    if ( m_winfo.onAllDesktops() ) {
		KWin::setOnAllDesktops(m_winfo.win(), false);
	    } else {
		KWin::setOnAllDesktops(m_winfo.win(), true);
	    }
	    break;
	case CloseOp: {
	    NETRootInfo ri( qt_xdisplay(),  0 );
	    ri.closeWindowRequest( m_winfo.win() );
	} break;
	default:
	    break;
    }
}
Пример #5
0
bool KKeyNative::init(const KKey &key)
{
    // Get any extra mods required by the sym.
    //  E.g., XK_Plus requires SHIFT on the en layout.
    m_sym = key.sym();
    uint modExtra = KKeyServer::Sym(m_sym).getModsRequired();
    // Get the X modifier equivalent.
    if(!m_sym || !KKeyServer::modToModX(key.modFlags() | modExtra, m_mod))
    {
        m_sym = m_mod = 0;
        m_code = 0;
        return false;
    }

    // XKeysymToKeycode returns the wrong keycode for XK_Print and XK_Break.
    // Specifically, it returns the code for SysReq instead of Print
    // Only do this for the default Xorg layout, other keycode mappings
    // (e.g. evdev) don't need or want it.
    if(m_sym == XK_Print && !(m_mod & Mod1Mask) && XKeycodeToKeysym(qt_xdisplay(), 111, 0) == XK_Print)
        m_code = 111; // code for Print
    else if(m_sym == XK_Break || ((m_sym == XK_Pause && (m_mod & ControlMask)) && XKeycodeToKeysym(qt_xdisplay(), 114, 0) == XK_Pause))
        m_code = 114;
    else
        m_code = XKeysymToKeycode(qt_xdisplay(), m_sym);

    if(!m_code && m_sym)
        kdDebug(125) << "Couldn't get code for sym" << endl;
    // Now get the true sym formed by the modifiers
    //  E.g., Shift+Equal => Plus on the en layout.
    if(key.modFlags() && ((m_sym < XK_Home || m_sym > XK_Begin) && m_sym != XK_Insert && m_sym != XK_Delete))
        KKeyServer::codeXToSym(m_code, m_mod, m_sym);

    return true;
}
Пример #6
0
/*!
  Different from QWidget::isActiveWindow()
 */
bool KXtWidget::isActiveWindow() const
{
    Window win;
    int revert;
    XGetInputFocus( qt_xdisplay(), &win, &revert );

    if ( win == None) return FALSE;

    QWidget *w = find( (WId)win );
    if ( w ) {
        // We know that window
        return w->topLevelWidget() == topLevelWidget();
    } else {
        // Window still may be a parent (if top-level is foreign window)
        Window root, parent;
        Window cursor = winId();
        Window *ch;
        unsigned int nch;
        while ( XQueryTree(qt_xdisplay(), cursor, &root, &parent, &ch, &nch) ) {
            if (ch) XFree( (char*)ch);
            if ( parent == win ) return TRUE;
            if ( parent == root ) return FALSE;
            cursor = parent;
        }
        return FALSE;
    }
}
Пример #7
0
void qt_xdnd_handle_selection_request( const XSelectionRequestEvent * req )
{
    if ( !req )
	return;
    XEvent evt;
    evt.xselection.type = SelectionNotify;
    evt.xselection.display = req->display;
    evt.xselection.requestor = req->requestor;
    evt.xselection.selection = req->selection;
    evt.xselection.target = req->target;
    evt.xselection.property = None;
    evt.xselection.time = req->time;
    const char* format = qt_xdnd_atom_to_str( req->target );
    if ( format && qt_xdnd_source_object &&
	 qt_xdnd_source_object->provides( format ) ) {
	QByteArray a = qt_xdnd_source_object->encodedData(format);
	XChangeProperty ( qt_xdisplay(), req->requestor, req->property,
			  req->target, 8, PropModeReplace,
			  (unsigned char *)a.data(), a.size() );
	evt.xselection.property = req->property;
    }
    // ### this can die if req->requestor crashes at the wrong
    // ### moment
    XSendEvent( qt_xdisplay(), req->requestor, False, 0, &evt );
}
Пример #8
0
void KoToolDockMoveManager::doMoveInternal()
{
    if ( !working )
        return;

    if (!pauseMoveX)
        rx = QCursor::pos().x();

    if (!pauseMoveY)
        ry = QCursor::pos().y();

    xp = rx - offX;
    yp = ry - offY;

    emit positionChanged();

    if (check(xp, yp, w, h)) {
        paintProcess(false,xp, yp, w, h);

#if defined Q_WS_X11 && !defined K_WS_QTONLY
        XFlush(qt_xdisplay());
        XSync(qt_xdisplay(),false);
#endif
    }
}
Пример #9
0
void KDETrayProxy::withdrawWindow(Window w)
{
    XWithdrawWindow(qt_xdisplay(), w, qt_xscreen());
    static Atom wm_state = XInternAtom(qt_xdisplay(), "WM_STATE", False);
    for(;;)
    {
        Atom type;
        int format;
        unsigned long length, after;
        unsigned char *data;
        int r = XGetWindowProperty(qt_xdisplay(), w, wm_state, 0, 2, False, AnyPropertyType, &type, &format, &length, &after, &data);
        bool withdrawn = true;
        if(r == Success && data && format == 32)
        {
            withdrawn = (*(long *)data == WithdrawnState);
            XFree((char *)data);
        }
        if(withdrawn)
            return; // --->
        struct timeval tm;
        tm.tv_sec = 0;
        tm.tv_usec = 10 * 1000; // 10ms
        select(0, NULL, NULL, NULL, &tm);
    }
}
Пример #10
0
GlobalKey::GlobalKey(CommandDef *cmd)
{
    m_key = QAccel::stringToKey(cmd->accel);
    m_state = 0;
    if (m_key & Qt::SHIFT) {
        m_key &= ~Qt::SHIFT;
        m_state |= 1;
    }
    if (m_key & Qt::CTRL) {
        m_key &= ~Qt::CTRL;
        m_state |= 4;
    }
    if (m_key & Qt::ALT) {
        m_key &= ~Qt::ALT;
        m_state |= 8;
    }
    m_key &= ~Qt::UNICODE_ACCEL;
    for (const TransKey *t = g_rgQtToSymX; t->x_key; t++) {
        if (t->qt_key == m_key) {
            m_key = t->x_key;
            break;
        }
    }
    m_key = XKeysymToKeycode( qt_xdisplay(), m_key);
    XSync( qt_xdisplay(), 0 );
    XErrorHandler savedErrorHandler = XSetErrorHandler(XGrabErrorHandler);
    XGrabKey( qt_xdisplay(), m_key, m_state,
              qt_xrootwin(), True, GrabModeAsync, GrabModeSync);
    XSync( qt_xdisplay(), 0 );
    XSetErrorHandler( savedErrorHandler );
}
Пример #11
0
// FINISHED - set defaults...
void Kaptan::accept()
{
    // Kicker değişkenlerini ayarlayalım...
    // 	- İkonların üzerine gelince büyüme efektini aç...
    KConfig kickerconf("kickerrc", false, false);
    kickerconf.setGroup("buttons");
    kickerconf.writeEntry("EnableIconZoom", true);
    kickerconf.sync();

    // Kicker'ı DCOP ile dürtelim ki yeni ayarları yüklesin
    if (!kapp->dcopClient()->isAttached())
        kapp->dcopClient()->attach();

    QByteArray data;
    QCString appname;
    if (DefaultScreen(qt_xdisplay()) == 0)
        appname = "kicker";
    else
        appname.sprintf("kicker-screen-%d", DefaultScreen(qt_xdisplay()));
    kapp->dcopClient()->send( appname, "kicker", "configure()", data );

    // KDE değişkenlerini ayarlayalım...
    // 	- Düğmeler üzerinde simgeleri görünsün
    // 	- Combo'lar açılırken efektli açılsın
    // 	- Renk şeması lipstikwhite olsun
    KGlobal::config()->setGroup("KDE");
    KGlobal::config()->writeEntry("ShowIconsOnPushButtons", true,true, true);
    KGlobal::config()->writeEntry("EffectAnimateCombo", true, true, true);
    KGlobal::config()->writeEntry("colorScheme", "lipstikwhite.kcsrc", true, true, true);

    KGlobal::config()->sync();

    exit(0);
}
Пример #12
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()
      clearWState( 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);

    setGeometry( pi->x, pi->y, pi->width, pi->height );
}
Пример #13
0
void KStart::applyStyle(Window w) {
    if (window)
	KWM::prepareForSwallowing(w);
    if (desktop >= 0) {
	if (KWM::desktop(w) != desktop)
	    KWM::moveToDesktop(w, desktop);
    }
    if (maximize) {
	debug("do maximize");
	KWM::doMaximize(w, true);
    }
    if (iconify)
	KWM::setIconify(w, true);
    if (sticky) {
	KWM::setSticky(w, true);
    }
    if (decoration != KWM::normalDecoration) {
	KWM::setDecoration(w, decoration);
	if (decoration & KWM::staysOnTop )
	  XRaiseWindow( qt_xdisplay(), w);
    }

    XSync(qt_xdisplay(), False);
    if (window) {
	XMapWindow(qt_xdisplay(), w);
	XSync(qt_xdisplay(), False);
    }
    if (activate)
      KWM::activate(w);
    XSync(qt_xdisplay(), False);
}
Пример #14
0
bool RandRScreen::applyProposed()
{
    // kdDebug() << k_funcinfo << " size " << (SizeID)proposedSize() << ", rotation " << proposedRotation() << ", refresh " <<
    // refreshRateIndexToHz(proposedSize(), proposedRefreshRate()) << endl;

    Status status;

    if(proposedRefreshRate() < 0)
        status = XRRSetScreenConfig(qt_xdisplay(), d->config, DefaultRootWindow(qt_xdisplay()), (SizeID)proposedSize(), (Rotation)proposedRotation(),
                                    CurrentTime);
    else
    {
        if(refreshRateIndexToHz(proposedSize(), proposedRefreshRate()) <= 0)
        {
            m_proposedRefreshRate = 0;
        }
        status = XRRSetScreenConfigAndRate(qt_xdisplay(), d->config, DefaultRootWindow(qt_xdisplay()), (SizeID)proposedSize(),
                                           (Rotation)proposedRotation(), refreshRateIndexToHz(proposedSize(), proposedRefreshRate()), CurrentTime);
    }

    // kdDebug() << "New size: " << WidthOfScreen(ScreenOfDisplay(QPaintDevice::x11AppDisplay(), screen)) << ", " <<
    // HeightOfScreen(ScreenOfDisplay(QPaintDevice::x11AppDisplay(), screen)) << endl;

    if(status == RRSetConfigSuccess)
    {
        m_currentSize = m_proposedSize;
        m_currentRotation = m_proposedRotation;
        m_currentRefreshRate = m_proposedRefreshRate;
        return true;
    }

    return false;
}
Пример #15
0
void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode, bool active )
    {
    QWidget *widget = active ? deco[Active]->widget() : deco[Inactive]->widget();

    // FRAME duped from client.cpp
    if( mode == Unsorted )
        {
        XShapeCombineRegion( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
            reg.handle(), ShapeSet );
        }
    else
        {
        QMemArray< QRect > rects = reg.rects();
        XRectangle* xrects = new XRectangle[ rects.count() ];
        for( unsigned int i = 0;
             i < rects.count();
             ++i )
            {
            xrects[ i ].x = rects[ i ].x();
            xrects[ i ].y = rects[ i ].y();
            xrects[ i ].width = rects[ i ].width();
            xrects[ i ].height = rects[ i ].height();
            }
        XShapeCombineRectangles( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
	    xrects, rects.count(), ShapeSet, mode );
        delete[] xrects;
        }
    if( active )
        mask = reg; // keep shape of the active window for unobscuredRegion()
    }
Пример #16
0
QRect KWM::geometry(Window w, bool including_frame){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "KWM_WIN_FRAME_GEOMETRY", False);
  QRect result;
  if (including_frame){
    if (getQRectProperty(w, a, result))
      return result;
  }
  XWindowAttributes attr;
  if (XGetWindowAttributes(qt_xdisplay(), w, &attr)){
    if (getQRectProperty(w, a, result)){
      result.setWidth(attr.width);
      result.setHeight(attr.height);
    }
    else{
      int x, y;
      Window child;
      XTranslateCoordinates(qt_xdisplay(),
			    w, qt_xrootwin(),
			    0, 0, &x, &y, &child);
      result.setRect(x, y, attr.width, attr.height);
    }
  }
  return result;
}
Пример #17
0
StartupId::StartupId( QWidget* parent, const char* name )
    :   QWidget( parent, name ),
	startup_info( KStartupInfo::CleanOnCantDetect ),
	startup_widget( NULL ),
	blinking( true ),
	bouncing( false )
    {
    hide(); // is QWidget only because of x11Event()
    if( kde_startup_status == StartupPre )
        {
        kde_splash_progress = XInternAtom( qt_xdisplay(), "_KDE_SPLASH_PROGRESS", False );
        XWindowAttributes attrs;
        XGetWindowAttributes( qt_xdisplay(), qt_xrootwin(), &attrs);
        XSelectInput( qt_xdisplay(), qt_xrootwin(), attrs.your_event_mask | SubstructureNotifyMask);
        kapp->installX11EventFilter( this );
        }
    connect( &update_timer, SIGNAL( timeout()), SLOT( update_startupid()));
    connect( &startup_info,
        SIGNAL( gotNewStartup( const KStartupInfoId&, const KStartupInfoData& )),
        SLOT( gotNewStartup( const KStartupInfoId&, const KStartupInfoData& )));
    connect( &startup_info,
        SIGNAL( gotStartupChange( const KStartupInfoId&, const KStartupInfoData& )),
        SLOT( gotStartupChange( const KStartupInfoId&, const KStartupInfoData& )));
    connect( &startup_info,
        SIGNAL( gotRemoveStartup( const KStartupInfoId&, const KStartupInfoData& )),
        SLOT( gotRemoveStartup( const KStartupInfoId& )));
    }
Пример #18
0
void KWM::unregisterSoundEvent(const QString &event){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "KDE_UNREGISTER_SOUND_EVENT", False);

  XEvent ev;
  int status;
  long mask;
  memset(&ev, 0, sizeof(ev));
  ev.xclient.type = ClientMessage;
  ev.xclient.window = qt_xrootwin();
  ev.xclient.message_type = a;
  ev.xclient.format = 8;

  int i;
  const char* s = event.data();
  for (i=0;i<19 && s[i];i++)
    ev.xclient.data.b[i]=s[i];

  mask = SubstructureRedirectMask;

  status = XSendEvent(qt_xdisplay(),
		      qt_xrootwin(),
		      False, mask, &ev);
}
Пример #19
0
void KWM::sendKWMCommand(const QString &command){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "KWM_COMMAND", False);

  XEvent ev;
  int status;
  long mask;
  memset(&ev, 0, sizeof(ev));
  ev.xclient.type = ClientMessage;
  ev.xclient.window = qt_xrootwin();
  ev.xclient.message_type = a;
  ev.xclient.format = 8;

  int i;
  const char* s = command.data();
  for (i=0;i<19 && s[i];i++)
    ev.xclient.data.b[i]=s[i];

  mask = SubstructureRedirectMask;

  status = XSendEvent(qt_xdisplay(),
		      qt_xrootwin(),
		      False, mask, &ev);
}
Пример #20
0
void KWM::close(Window w){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "WM_DELETE_WINDOW", False);
  static Atom ap = 0;
  if (!ap)
    ap = XInternAtom(qt_xdisplay(), "WM_PROTOCOLS", False);

  // clients with WM_DELETE_WINDOW protocol set are
  // closed via wm_delete_window ClientMessage.
  // Others are destroyed.
  Atom *p;
  int i,n;
  if (XGetWMProtocols(qt_xdisplay(), w, &p, &n)){
    for (i = 0; i < n; i++){
      if (p[i] == a){
	sendClientMessage(w, ap, a);
	XFree((char*)p);
	return;
      }
    }
    if (n>0)
      XFree(p);
  }
  // client will not react on wm_delete_window. We have no choice
  // but destroy his connection to the XServer.
  XKillClient(qt_xdisplay(), w);
}
Пример #21
0
void KWM::enableSessionManagement(Window w){
  static Atom a = 0;
  if (!a)
    a = XInternAtom(qt_xdisplay(), "WM_SAVE_YOURSELF", False);
  static Atom b = 0;
  if (!b)
    b = XInternAtom(qt_xdisplay(), "KWM_SAVE_YOURSELF", False);
  Atom *p;
  int i,n;
  if (XGetWMProtocols(qt_xdisplay(), w, &p, &n)){
    for (i = 0; i < n; i++){
      if (p[i] == a)
	return;
    }
    Atom *pn = new Atom[n+1];
    for (i=0; i<n; i++)
      pn[i] = p[i];
    pn[i] = a;
    XSetWMProtocols(qt_xdisplay(), w, pn, n+1);
    if (n>0)
      XFree((char*)p);
    delete[] pn;	
  }
  else
    XSetWMProtocols(qt_xdisplay(), w, &a, 1);
  setSimpleProperty(w, b, 1);
}
Пример #22
0
static 
Window findRealWindow( Window w, int depth = 0 )
{
    if( depth > 5 )
        return None;
    static Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False );
    Atom type;
    int format;
    unsigned long nitems, after;
    unsigned char* prop;
    if( XGetWindowProperty( qt_xdisplay(), w, wm_state, 0, 0, False, AnyPropertyType,
                &type, &format, &nitems, &after, &prop ) == Success ) {
        if( prop != NULL )
            XFree( prop );
        if( type != None )
            return w;
    }
    Window root, parent;
    Window* children;
    unsigned int nchildren;
    Window ret = None;
    if( XQueryTree( qt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) {
        for( unsigned int i = 0;
             i < nchildren && ret == None;
             ++i )
            ret = findRealWindow( children[ i ], depth + 1 );
        if( children != NULL )
            XFree( children );
    }
    return ret;
}
Пример #23
0
void RandRScreen::loadSettings()
{
    if(d->config)
        XRRFreeScreenConfigInfo(d->config);

    d->config = XRRGetScreenInfo(qt_xdisplay(), RootWindow(qt_xdisplay(), m_screen));
    Q_ASSERT(d->config);

    Rotation rotation;
    m_currentSize = m_proposedSize = XRRConfigCurrentConfiguration(d->config, &rotation);
    m_currentRotation = m_proposedRotation = rotation;

    m_pixelSizes.clear();
    m_mmSizes.clear();
    int numSizes;
    XRRScreenSize *sizes = XRRSizes(qt_xdisplay(), m_screen, &numSizes);
    for(int i = 0; i < numSizes; i++)
    {
        m_pixelSizes.append(QSize(sizes[i].width, sizes[i].height));
        m_mmSizes.append(QSize(sizes[i].mwidth, sizes[i].mheight));
    }

    m_rotations = XRRRotations(qt_xdisplay(), m_screen, &rotation);

    m_currentRefreshRate = m_proposedRefreshRate = refreshRateHzToIndex(m_currentSize, XRRConfigCurrentRate(d->config));
}
Пример #24
0
void Gesture::grab_mouse( bool grab_P )
    {
    if( grab_P )
        {
        KXErrorHandler handler;
        static int mask[] = { 0, Button1MotionMask, Button2MotionMask, Button3MotionMask,
            Button4MotionMask, Button5MotionMask, ButtonMotionMask, ButtonMotionMask,
            ButtonMotionMask, ButtonMotionMask };
#define XCapL KKeyNative::modXLock()
#define XNumL KKeyNative::modXNumLock()
#define XScrL KKeyNative::modXScrollLock()
        unsigned int mods[ 8 ] = 
            {
            0, XCapL, XNumL, XNumL | XCapL,
            XScrL, XScrL | XCapL,
            XScrL | XNumL, XScrL | XNumL | XCapL
            };
#undef XCapL
#undef XNumL
#undef XScrL
        for( int i = 0;
             i < 8;
             ++i )
            XGrabButton( qt_xdisplay(), button, mods[ i ], qt_xrootwin(), False,
                ButtonPressMask | ButtonReleaseMask | mask[ button ], GrabModeAsync, GrabModeAsync,
                None, None );
        bool err = handler.error( true );
        kdDebug( 1217 ) << "Gesture grab:" << err << endl;
        }
    else
        {
        kdDebug( 1217 ) << "Gesture ungrab" << endl;
        XUngrabButton( qt_xdisplay(), button, AnyModifier, qt_xrootwin());
        }
    }
Пример #25
0
void KSharedPixmap::init()
{
    d->pixmap = XInternAtom(qt_xdisplay(), "PIXMAP", false);
    QCString atom;
    atom.sprintf("target prop for window %lx", static_cast<unsigned long int>(winId()));
    d->target = XInternAtom(qt_xdisplay(), atom.data(), false);
    d->selection = None;
}
Пример #26
0
bool KSharedPixmap::isAvailable(const QString & name) const
{
    QString str = QString("KDESHPIXMAP:%1").arg(name);
    Atom sel = XInternAtom(qt_xdisplay(), str.latin1(), true);
    if (sel == None)
	return false;
    return XGetSelectionOwner(qt_xdisplay(), sel) != None;
}
Пример #27
0
Atom KWinSelectionOwner::make_selection_atom(int screen_P)
{
    if(screen_P < 0)
        screen_P = DefaultScreen(qt_xdisplay());
    char tmp[30];
    sprintf(tmp, "WM_S%d", screen_P);
    return XInternAtom(qt_xdisplay(), tmp, False);
}
Пример #28
0
void Gesture::stroke_timeout()
    {
    kdDebug( 1217 ) << "GESTURE: timeout" << endl;
    XAllowEvents( qt_xdisplay(), AsyncPointer, CurrentTime );
    XUngrabPointer( qt_xdisplay(), CurrentTime );
    mouse_replay( false );
    recording = false;
    }
Пример #29
0
void ungrabXServer()
{
    assert(server_grab_count > 0);
    if(--server_grab_count == 0)
    {
        XUngrabServer(qt_xdisplay());
        XFlush(qt_xdisplay());
        Notify::sendPendingEvents();
    }
}
Пример #30
0
void Shape::init()
{
    kwin_shape_version = 0;
    int dummy;
    if(!XShapeQueryExtension(qt_xdisplay(), &kwin_shape_event, &dummy))
        return;
    int major, minor;
    if(!XShapeQueryVersion(qt_xdisplay(), &major, &minor))
        return;
    kwin_shape_version = major * 0x10 + minor;
}