static void
screensaver_disable_x11 (ScreenSaver * screensaver)
{
#ifdef HAVE_XTEST
  if (screensaver->have_xtest) {
    XLockDisplay (screensaver->display);
    XGetScreenSaver (screensaver->display, &screensaver->timeout,
        &screensaver->interval,
        &screensaver->prefer_blanking, &screensaver->allow_exposures);
    XUnlockDisplay (screensaver->display);

    if (screensaver->timeout != 0) {
      g_timeout_add_seconds (screensaver->timeout / 2,
          (GSourceFunc) fake_event, screensaver);
    } else {
      g_timeout_add_seconds (XSCREENSAVER_MIN_TIMEOUT / 2,
          (GSourceFunc) fake_event, screensaver);
    }

    return;
  }
#endif

  XLockDisplay (screensaver->display);
  XGetScreenSaver (screensaver->display, &screensaver->timeout,
      &screensaver->interval,
      &screensaver->prefer_blanking, &screensaver->allow_exposures);
  XSetScreenSaver (screensaver->display, 0, 0,
      DontPreferBlanking, DontAllowExposures);
  XUnlockDisplay (screensaver->display);
}
コード例 #2
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
void 
XWindow::SetLayer (int layer)
{
  char *state = NULL;

  Window mRootWin = RootWindow (_display, DefaultScreen (_display));
  XEvent xev;
  memset (&xev, 0, sizeof(xev));

  if (_wmType & wm_LAYER) {

    if (!_state.origLayer) 
      _state.origLayer = GetGnomeLayer ();
    
    xev.type = ClientMessage;
    xev.xclient.display = _display;
    xev.xclient.window = _XWindow;
    xev.xclient.message_type = XA_WIN_LAYER;
    xev.xclient.format = 32;
    xev.xclient.data.l [0] = layer ? WIN_LAYER_ABOVE_DOCK : _state.origLayer;
    xev.xclient.data.l [1] = CurrentTime;
    PTRACE(4, "X11\tLayered style stay on top (layer " << xev.xclient.data.l[0] << ")");
    
    XLockDisplay (_display);
    XSendEvent (_display, mRootWin, FALSE, SubstructureNotifyMask,  &xev);
    XUnlockDisplay (_display);

  } 
  else if (_wmType & wm_NETWM) {

    xev.type = ClientMessage;
    xev.xclient.message_type = XA_NET_WM_STATE;
    xev.xclient.display = _display;
    xev.xclient.window = _XWindow;
    xev.xclient.format = 32;
    xev.xclient.data.l [0] = layer;

    if (_wmType & wm_STAYS_ON_TOP) 
      xev.xclient.data.l [1] = XA_NET_WM_STATE_STAYS_ON_TOP;
    else 
      if (_wmType & wm_ABOVE) 
        xev.xclient.data.l [1] = XA_NET_WM_STATE_ABOVE;
    else 
      if (_wmType & wm_FULLSCREEN) 
        xev.xclient.data.l [1] = XA_NET_WM_STATE_FULLSCREEN;
    else 
      if (_wmType & wm_BELOW) 
        xev.xclient.data.l [1] = XA_NET_WM_STATE_BELOW;

    XLockDisplay (_display);
    XSendEvent (_display, mRootWin, FALSE, SubstructureRedirectMask, &xev);
    state = XGetAtomName (_display, xev.xclient.data.l [1]);
    PTRACE(4, "X11\tNET style stay on top (layer " << layer << "). Using state " << state );
    XFree (state);
    XUnlockDisplay (_display);
  }
}
コード例 #3
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
int 
XWindow::GetWMType ()
{
  Atom *args = NULL;

  unsigned int i = 0;
  int wmType = 0;
  int metacityHack = 0;
  unsigned long nitems = 0;

  // check if WM supports layers
  if (GetWindowProperty (XA_WIN_PROTOCOLS, &args, &nitems)) {
    
    PTRACE(4, "X11\tDetected WM supports layers");
    for (i = 0; i < nitems; i++) {
      
      if (args [i] == XA_WIN_LAYER) {
        wmType |= wm_LAYER;
        metacityHack |= 1;
      } 
      else 
        metacityHack |= 2;
    }

    XLockDisplay (_display);
    XFree (args);
    XUnlockDisplay (_display);

    // metacity WM reports that it supports layers, 
    // but it is not really true :-)
    if (wmType && metacityHack == 1) {
      wmType ^= wm_LAYER;
      PTRACE(4, "X11\tUsing workaround for Metacity bug");
    }
  }

  // NETWM
  if (GetWindowProperty (XA_NET_SUPPORTED, &args, &nitems)) {
    
    PTRACE(4, "X11\tDetected wm supports NetWM.");

    for (i = 0; i < nitems; i++) 
      wmType |= GetSupportedState (args[i]);
    
    XLockDisplay (_display);
    XFree (args);
    XUnlockDisplay (_display);
  }

  // unknown WM
  if (wmType == 0) {
    PTRACE(4, "X11\tUnknown wm type...");
  }
  
  return wmType;
}
コード例 #4
0
ファイル: vdpau_gfxdriver.c プロジェクト: kuii/dfbNEON
static DFBResult
driver_init_device( CoreGraphicsDevice *device,
                    GraphicsDeviceInfo *device_info,
                    void               *driver_data,
                    void               *device_data )
{
     VDPAUDriverData *vdrv = driver_data;
     VDPAUDeviceData *vdev = device_data;
     DFBX11VDPAU     *vdp  = vdrv->vdp;

     VdpStatus status;

     XLockDisplay( vdrv->display );
     status = vdp->OutputSurfaceCreate( vdp->device, VDP_RGBA_FORMAT_B8G8R8A8, 1, 1, &vdev->white );
     XUnlockDisplay( vdrv->display );
     if (status) {
          D_ERROR( "DirectFB/X11/VDPAU: OutputSurfaceCreate( RGBA 1x1 ) failed (status %d, '%s')!\n",
                   status, vdp->GetErrorString( status ) );
          return DFB_FAILURE;
     }

     uint32_t    white_bits  = 0xffffffff;
     const void *white_ptr   = &white_bits;
     uint32_t    white_pitch = 4;
     VdpRect     white_rect  = { 0, 0, 1, 1 };

     XLockDisplay( vdrv->display );
     status = vdp->OutputSurfacePutBitsNative( vdev->white, &white_ptr, &white_pitch, &white_rect );
     XUnlockDisplay( vdrv->display );
     if (status) {
          D_ERROR( "DirectFB/X11/VDPAU: OutputSurfacePutBitsNative( RGBA 1x1 ) failed (status %d, '%s')!\n",
                   status, vdp->GetErrorString( status ) );
          return DFB_FAILURE;
     }

     /* fill device info */
     snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "VDPAU" );
     snprintf( device_info->name,   DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH,   "Output Surface Rendering" );

     /* device limitations */
     device_info->limits.surface_byteoffset_alignment = 8;
     device_info->limits.surface_bytepitch_alignment  = 8;

     device_info->caps.flags    = 0;
     device_info->caps.accel    = VDPAU_SUPPORTED_DRAWINGFUNCTIONS |
                                  VDPAU_SUPPORTED_BLITTINGFUNCTIONS;
     device_info->caps.drawing  = VDPAU_SUPPORTED_DRAWINGFLAGS;
     device_info->caps.blitting = VDPAU_SUPPORTED_BLITTINGFLAGS;

     return DFB_OK;
}
コード例 #5
0
ファイル: GLWinX11.cpp プロジェクト: ACanadianKernel/pcsx2
void GLWindow::GetWindowSize()
{
    if (!NativeDisplay or !NativeWindow) return;

	u32 depth = 0;
#ifdef GLX_API
	unsigned int borderDummy;
	Window winDummy;
    s32 xDummy;
    s32 yDummy;
	u32 width;
	u32 height;

    XLockDisplay(NativeDisplay);
	XGetGeometry(NativeDisplay, NativeWindow, &winDummy, &xDummy, &yDummy, &width, &height, &borderDummy, &depth);
    XUnlockDisplay(NativeDisplay);
#endif

	// FIXME: Not sure it works but that could remove latest X11 bits.
#ifdef EGL_API
	int width;
	int height;
	eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &width);
	eglQuerySurface(eglDisplay, eglSurface, EGL_HEIGHT, &height);
#endif

    // update the gl buffer size
    UpdateWindowSize(width, height);

#ifndef USE_GSOPEN2
	// too verbose!
    ZZLog::Dev_Log("Resolution %dx%d. Depth %d bpp. Position (%d,%d)", width, height, depth, conf.x, conf.y);
#endif
}
コード例 #6
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
int 
XWindow::GetGnomeLayer ()
{
  Atom type;

  int format = 0;
  unsigned long count = 0;
  unsigned long bytesafter = 0;
  unsigned char *prop = NULL;

  long layer = WIN_LAYER_NORMAL;

  XLockDisplay (_display);
  if (XGetWindowProperty (_display, _XWindow,XA_WIN_LAYER, 0, 16384, false, XA_CARDINAL, &type, &format, &count, &bytesafter, &prop) 
      == Success && prop) {
    
    if (type == XA_CARDINAL && format == 32 && count == 1) 
      layer = ((long *) prop) [0];

    XFree(prop);
  }
  XUnlockDisplay(_display);

  return layer;
}
コード例 #7
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
void 
XWindow::SetDecoration (bool d)
{
  Atom motifHints;
  Atom mType;
  
  MotifWmHints setHints;
  MotifWmHints *getHints = NULL;
  
  unsigned char *args = NULL;

  int mFormat = 0;
  unsigned long mn = 0;
  unsigned long mb = 0;

  static unsigned int oldDecor = MWM_DECOR_ALL;
  static unsigned int oldFuncs = MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;

  XLockDisplay (_display);

  motifHints = XInternAtom (_display, "_MOTIF_WM_HINTS", 0);

  if (motifHints != None) {

    memset (&setHints, 0, sizeof (setHints));

    if (!d) {

      XGetWindowProperty (_display, _XWindow, motifHints, 0, 20, False, motifHints, &mType, &mFormat, &mn, &mb, &args);
      getHints = (MotifWmHints*) args;

      if (getHints) {

        if (getHints->flags & MWM_HINTS_DECORATIONS) 
          oldDecor = getHints->decorations;
        
        if (getHints->flags & MWM_HINTS_FUNCTIONS) 
          oldFuncs = getHints->functions;
        
        XFree(getHints);
      }

      
      setHints.decorations = 0;
    } 
    else {
    
      setHints.functions = oldFuncs;
      setHints.decorations = oldDecor;
    }

    setHints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
    
    XChangeProperty (_display, _XWindow, motifHints, motifHints, 32, PropModeReplace, (unsigned char *) &setHints, 5);
    
    _state.decoration=!_state.decoration;
  }

  XUnlockDisplay (_display);
}
コード例 #8
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
void
XWindow::Sync()
{
  XLockDisplay(_display);
  XSync (_display, False);
  XUnlockDisplay(_display);
}
コード例 #9
0
ファイル: ws.c プロジェクト: JasonFengIce/mplayer-android
void wsMainLoop(void)
{
    int delay = 20;

    mp_msg(MSGT_GPLAYER, MSGL_V, "[ws] init threads: %d\n", XInitThreads());
    XSynchronize(wsDisplay, False);
    XLockDisplay(wsDisplay);
// XIfEvent( wsDisplay,&wsEvent,wsEvents );

    while (wsTrue) {
        // handle pending events
        while (XPending(wsDisplay)) {
            XNextEvent(wsDisplay, &wsEvent);
            wsEvents(wsDisplay, &wsEvent);
            delay = 0;
        }

        usleep(delay * 1000); // FIXME!

        if (delay < 10 * 20)
            delay += 20;               // pump up delay up to 0.2 sec (low activity)
    }

    XUnlockDisplay(wsDisplay);
}
コード例 #10
0
ファイル: GLWinX11.cpp プロジェクト: madnessw/thesnow
void GLWindow::Force43Ratio()
{
#ifndef USE_GSOPEN2
    // avoid black border in fullscreen
    if (fullScreen && conf.isWideScreen) {
        conf.width = width;
        conf.height = height;
    }

    if(!fullScreen && !conf.isWideScreen) {
        // Compute the width based on height
        s32 new_width = (4*height)/3;
        // do not bother to resize for 5 pixels. Avoid a loop
        // due to round value
        if ( abs(new_width - width) > 5) {
            width = new_width;
            conf.width = new_width;
            // resize the window
            XLockDisplay(glDisplay);
            XResizeWindow(glDisplay, glWindow, new_width, height);
            XSync(glDisplay, False);
            XUnlockDisplay(glDisplay);
        }
    }
#endif
}
コード例 #11
0
void XCompcapMain::tick(float seconds)
{
	UNUSED_PARAMETER(seconds);

	PLock lock(&p->lock, true);

	if (!lock.isLocked())
		return;

	XCompcap::processEvents();

	if (XCompcap::windowWasReconfigured(p->win))
		updateSettings(0);

	if (!p->tex || !p->gltex)
		return;

	gs_entercontext(obs_graphics());

	if (p->lockX) {
		XLockDisplay(xdisp);
		XSync(xdisp, 0);
	}

	gs_copy_texture_region(p->tex, 0, 0, p->gltex, p->cur_cut_left,
			p->cur_cut_top, width(), height());

	if (p->lockX)
		XUnlockDisplay(xdisp);

	gs_leavecontext();
}
コード例 #12
0
int tc_x11source_acquire(TCX11Source *handle, uint8_t *data, int maxdata)
{
    int size = -1;

    if (handle == NULL || data == NULL || maxdata <= 0) {
        tc_log_error(__FILE__, "x11source_acquire: wrong (NULL) parameters");
        return size;
    }

    XLockDisplay(handle->dpy);
    /* OK, let's hack a bit our GraphicContext */
    XSetSubwindowMode(handle->dpy, handle->gc, IncludeInferiors);
    /* don't catch areas of windows covered by children windows */
    XCopyArea(handle->dpy, handle->root, handle->pix, handle->gc,
              0, 0, handle->width, handle->height, 0, 0);

    XSetSubwindowMode(handle->dpy, handle->gc, ClipByChildren);
    /* but draw such areas if windows are opaque */
    
    size = handle->acquire_image(handle, data, maxdata);
    if (size > 0) {
        handle->acquire_cursor(handle, data, maxdata); /* cannot fail */
    }
    XUnlockDisplay(handle->dpy);
    return size;
}
コード例 #13
0
ファイル: xtwitter.c プロジェクト: hamano/xtwitter
void xtwitter_x_loop(){
    XEvent event;
    XSelectInput(display, window, ExposureMask);
    while(1){
        while(XPending(display)){
            XLockDisplay(display);
            XNextEvent(display, &event);
            XUnlockDisplay(display);
            switch(event.type){
            case Expose:
                //printf("event: Expose count=%d\n", event.xexpose.count);
                XCopyArea(display, pixmap, window, gc,
                          0, 0, XTWITTER_WINDOW_WIDTH, XTWITTER_WINDOW_HEIGHT, 0, 0);
                //XFlush(display);
                break;
            case ClientMessage:
                if(event.xclient.data.l[0] == atom_delete_window){
                    return;
                }
                break;
            }
        }
        usleep(100000);
    }
}
コード例 #14
0
static void
screensaver_init_x11 (ScreenSaver * screensaver)
{
#ifdef HAVE_XTEST
  int a, b, c, d;

  XLockDisplay (screensaver->display);
  screensaver->have_xtest =
      (XTestQueryExtension (screensaver->display, &a, &b, &c, &d) == True);
  if (screensaver->have_xtest) {
    screensaver->keycode1 = XKeysymToKeycode (screensaver->display, XK_Alt_L);
    if (screensaver->keycode1 == 0) {
      g_warning ("keycode1 not existant");
    }
    screensaver->keycode2 = XKeysymToKeycode (screensaver->display, XK_Alt_R);
    if (screensaver->keycode2 == 0) {
      screensaver->keycode2 = XKeysymToKeycode (screensaver->display, XK_Alt_L);
      if (screensaver->keycode2 == 0) {
        g_warning ("keycode2 not existant");
      }
    }
    screensaver->keycode = &screensaver->keycode1;
  }
  XUnlockDisplay (screensaver->display);
#endif
}
コード例 #15
0
void XDisplayLock::lock()
{
	if (!islock) {
		XLockDisplay(XCompcap::disp());
		islock = true;
	}
}
コード例 #16
0
ファイル: drawpoly.c プロジェクト: barry963/Robot_project
void
drawpoly (int numpoints, int *polypoints)
{
  int i;
  XPoint *Points;
  Points = malloc (numpoints * sizeof (XPoint));
  if (Points == NULL)
    {
      TcGraphResult = grNoScanMem;
      return;
    }
  // Convert to viewport coordinates.
  for (i = 0; i < numpoints; i++)
    {
      Points[i].x = TcViewLeft + *polypoints++;
      Points[i].y = TcViewTop + *polypoints++;
    }
  // Now do the actual drawing.
  XLockDisplay (TcDisplay);
  XDrawLines (TcDisplay, TcPixmaps[TcActivePage], TcGc, Points, numpoints,
	      CoordModeOrigin);
  if (TcActivePage == TcVisualPage)
    {
      XDrawLines (TcDisplay, TcWindow, TcGc, Points, numpoints,
		  CoordModeOrigin);
      XSync (TcDisplay, False);
    }
  XUnlockDisplay (TcDisplay);
  free (Points);
}
コード例 #17
0
ファイル: x11.c プロジェクト: engur/fs-uae
static void set_above_state() {
    printf("_NET_WM_STATE = _NET_WM_STATE_ABOVE\n");
    Atom ATOM = XInternAtom(g_display, "ATOM", False);
    Atom _NET_WM_STATE = XInternAtom(g_display, "_NET_WM_STATE", False);
    Atom _NET_WM_STATE_ABOVE = XInternAtom(
        g_display, "_NET_WM_STATE_ABOVE", False);
    XChangeProperty(g_display, g_window, _NET_WM_STATE, ATOM, 32,
            PropModeReplace, (unsigned char *) &_NET_WM_STATE_ABOVE, 1);

    XEvent ev;
    memset(&ev, 0, sizeof(ev));
    ev.type = ClientMessage;
    ev.xclient.type         = ClientMessage;
    ev.xclient.message_type = XInternAtom(g_display, "_NET_WM_STATE", 0);
    ev.xclient.display      = g_display;
    ev.xclient.window       = g_window;
    ev.xclient.format       = 32;
    ev.xclient.data.l[0]    = 1; // set ? 1 : 0;

    // *_STAYS_ON_TOP is probably KDE-specific
    ev.xclient.data.l[1] = XInternAtom(
        g_display, "_NET_WM_STATE_STAYS_ON_TOP", 0);
    XLockDisplay(g_display);
    XSendEvent(g_display, XDefaultRootWindow(g_display), 0,
               SubstructureRedirectMask | SubstructureNotifyMask, &ev);

    // to work with some non-KDE WMs we should use _NET_WM_STATE_ABOVE
    ev.xclient.data.l[1] = XInternAtom(
        g_display, "_NET_WM_STATE_ABOVE", 0);
    XSendEvent(g_display, XDefaultRootWindow(g_display), 0,
               SubstructureRedirectMask | SubstructureNotifyMask, &ev);
    XUnlockDisplay(g_display);
}
コード例 #18
0
/**
 * Xlib-based handling of xcb events for glamor.
 *
 * We need to let the Xlib event filtering run on the event so that
 * Mesa's dri2_glx.c userspace event mangling gets run, and we
 * correctly get our invalidate events propagated into the driver.
 */
void
ephyr_glamor_process_event(xcb_generic_event_t *xev)
{

    uint32_t response_type = xev->response_type & 0x7f;
    /* Note the types on wire_to_event: there's an Xlib XEvent (with
     * the broken types) that it returns, and a protocol xEvent that
     * it inspects.
     */
    Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event);

    XLockDisplay(dpy);
    /* Set the event handler to NULL to get access to the current one. */
    wire_to_event = XESetWireToEvent(dpy, response_type, NULL);
    if (wire_to_event) {
        XEvent processed_event;

        /* OK they had an event handler.  Plug it back in, and call
         * through to it.
         */
        XESetWireToEvent(dpy, response_type, wire_to_event);
        xev->sequence = LastKnownRequestProcessed(dpy);
        wire_to_event(dpy, &processed_event, (xEvent *)xev);
    }
    XUnlockDisplay(dpy);
}
コード例 #19
0
ファイル: GLWinX11.cpp プロジェクト: madnessw/thesnow
void GLWindow::ResizeCheck()
{
	XEvent event;
    if (!glDisplay or !glWindow) return;

    XLockDisplay(glDisplay);
	while (XCheckTypedWindowEvent(glDisplay, glWindow, ConfigureNotify, &event))
	{
		if ((event.xconfigure.width != width) || (event.xconfigure.height != height))
		{
			width = event.xconfigure.width;
			height = event.xconfigure.height;
            Force43Ratio();
			UpdateWindowSize(width, height);
		}

        if (!fullScreen) {
            if ((event.xconfigure.x != conf.x) || (event.xconfigure.y != conf.y))
            {
                // Fixme; x&y occassionally gives values near the top left corner rather then the real values,
                // causing the window to change positions when adjusting ZZOgl's settings.
                conf.x = event.xconfigure.x;
                conf.y = event.xconfigure.y;
            }
        }
	}
    XUnlockDisplay(glDisplay);
}
コード例 #20
0
ファイル: primary.c プロジェクト: canalplus/r7oss
DFBResult
dfb_x11_destroy_window_handler( DFBX11 *x11, DestroyData *destroy )
{
     DFBX11Shared *shared = x11->shared;
     XWindow      *xw;

     D_DEBUG_AT( X11_Layer, "%s()\n", __FUNCTION__ );

     XLockDisplay( x11->display );

     xw = *(destroy->xw);

     if (xw) {
          *(destroy->xw) = NULL;

          dfb_x11_close_window( x11, xw );
          shared->window_count--;
     }

     XSync( x11->display, False );

     XUnlockDisplay( x11->display );

     return DFB_OK;
}
コード例 #21
0
	void processEvents()
	{
		PLock lock(&changeLock);

		XLockDisplay(disp());

		while (XEventsQueued(disp(), QueuedAfterReading) > 0) {
			XEvent ev;

			XNextEvent(disp(), &ev);

			if (ev.type == ConfigureNotify)
				changedWindows.insert(ev.xconfigure.event);

			if (ev.type == MapNotify)
				changedWindows.insert(ev.xmap.event);

			if (ev.type == Expose)
				changedWindows.insert(ev.xexpose.window);

			if (ev.type == DestroyNotify)
				changedWindows.insert(ev.xdestroywindow.event);
		}

		XUnlockDisplay(disp());
	}
コード例 #22
0
ファイル: x11input.c プロジェクト: Distrotech/DirectFB
/*
 * End thread, close device and free private data.
 */
static void
driver_close_device( void *driver_data )
{
     X11InputData *data   = driver_data;
     DFBX11       *x11    = data->x11;
     DFBX11Shared *shared = x11->shared;

     D_DEBUG_AT( X11_Input, "%s()\n", __FUNCTION__ );

     /* stop input thread */
     data->stop = true;

     if (!shared->x_error) {
          XLockDisplay( x11->display );
          XSync( x11->display, False );
          XUnlockDisplay( x11->display );
     }

     /* it is possible that this "close" function is called from the same
      * thread that the input device is actually running on.
      * This happens when you e.g. click the close box with your mouse.
      * As a fix, we check if we are this thread. */
     if (data->thread != direct_thread_self()) {
          direct_thread_join( data->thread );
          direct_thread_destroy( data->thread );
     }

     /* free private data */
     D_FREE ( data );
}
コード例 #23
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
void 
XWindow::GetWindow (int *x, 
                     int *y, 
                     unsigned int *windowWidth, 
                     unsigned int *windowHeight)
{
  unsigned int ud = 0; 
  Window _dw;
  
  int oldx = 0; 
  int oldy = 0;
  
  Window root;
  bool decoration = false;
  
  decoration = _state.decoration;
  SetDecoration (false);

  XLockDisplay (_display);
  XSync (_display, False); 
  XGetGeometry (_display, _XWindow, &root, &oldx, &oldy, windowWidth, windowHeight, &ud, &ud);
  XTranslateCoordinates (_display, _XWindow, root, oldx, oldy, x, y, &_dw);
  XUnlockDisplay (_display);

  SetDecoration (decoration);
}
コード例 #24
0
ファイル: x11input.c プロジェクト: Distrotech/DirectFB
/*
 * Fetch one entry from the device's keymap if supported.
 * this does a fake mapping based on the orginal DFB code
 */
static DFBResult
driver_get_keymap_entry( CoreInputDevice           *device,
                         void                      *driver_data,
                         DFBInputDeviceKeymapEntry *entry )
{
     int           i;
     X11InputData *data = driver_data;
     DFBX11       *x11  = data->x11;

     XLockDisplay( x11->display );

     for (i=0; i<4; i++) {
          KeySym xSymbol = XkbKeycodeToKeysym( x11->display, entry->code, 0, i );

          if (i == 0)
               entry->identifier = xsymbol_to_id( xSymbol );

          entry->symbols[i] = xsymbol_to_symbol( xSymbol );
     }

     XUnlockDisplay( x11->display );

     /* is CapsLock effective? */
     if (entry->identifier >= DIKI_A && entry->identifier <= DIKI_Z)
          entry->locks |= DILS_CAPS;

     /* is NumLock effective? */
     if (entry->identifier >= DIKI_KP_DECIMAL && entry->identifier <= DIKI_KP_9)
          entry->locks |= DILS_NUM;

     return DFB_OK;
}
コード例 #25
0
ファイル: xwindow.cpp プロジェクト: Klom/ekiga
void 
XWindow::SetEWMHFullscreen (int action)
{
  if (_wmType & wm_FULLSCREEN) {

    // create an event event to toggle fullscreen mode
    XEvent xev;
    
    xev.xclient.type = ClientMessage;
    xev.xclient.serial = 0;
    xev.xclient.send_event = True;
    xev.xclient.message_type = XInternAtom (_display, "_NET_WM_STATE", False);
    xev.xclient.window = _XWindow;
    xev.xclient.format = 32;
    
    xev.xclient.data.l[0] = action;
    xev.xclient.data.l[1] = XInternAtom (_display, "_NET_WM_STATE_FULLSCREEN", False);
    xev.xclient.data.l[2] = 0;
    xev.xclient.data.l[3] = 0;
    xev.xclient.data.l[4] = 0;

    // send the event to the window
    XLockDisplay (_display);
    if (!XSendEvent (_display, _rootWindow, FALSE, SubstructureRedirectMask | SubstructureNotifyMask, &xev)) {
      PTRACE(1, "X11\tSetEWMHFullscreen failed");
    }
    XUnlockDisplay (_display);
  }
}
コード例 #26
0
ファイル: Xmisc.c プロジェクト: Garyteck/jogl
/*   Java->C glue code:
 *   Java package: jogamp.nativewindow.x11.X11Lib
 *    Java method: void XLockDisplay(long display)
 *     C function: void XLockDisplay(Display *  display);
 */
JNIEXPORT void JNICALL 
Java_jogamp_nativewindow_x11_X11Lib_XLockDisplay__J(JNIEnv *env, jclass _unused, jlong display) {
  if(0==display) {
      NativewindowCommon_FatalError(env, "invalid display connection..");
  }
  XLockDisplay((Display *) (intptr_t) display);
}
コード例 #27
0
ファイル: cromemco-dazzler.c プロジェクト: BleuLlama/z80pack
/* switch DAZZLER off from front panel */
void cromemco_dazzler_off(void)
{
	struct timespec timer;	/* sleep timer */

	state = 0;

	timer.tv_sec = 0;
	timer.tv_nsec = 50000000L;
	nanosleep(&timer, NULL);

	if (thread != 0) {
		pthread_cancel(thread);
		pthread_join(thread, NULL);
		thread = 0;
	}

	if (display != NULL) {
		XLockDisplay(display);
		XFreePixmap(display, pixmap);
		XFreeGC(display, gc);
		XCloseDisplay(display);
		XUnlockDisplay(display);
		display = NULL;
	}
}
コード例 #28
0
ファイル: x11display.c プロジェクト: freevo/kaa-display
PyObject *
X11Display_PyObject__lock(X11Display_PyObject * self, PyObject * args)
{
    XLockDisplay(self->display);
    Py_INCREF(Py_None);
    return Py_None;
}
コード例 #29
0
ファイル: x11_shadow.c プロジェクト: DavBfr/FreeRDP
BOOL x11_shadow_check_resize(x11ShadowSubsystem* subsystem)
{
	MONITOR_DEF* virtualScreen;
	XWindowAttributes attr;

	XLockDisplay(subsystem->display);
	XGetWindowAttributes(subsystem->display, subsystem->root_window, &attr);
	XUnlockDisplay(subsystem->display);

	if (attr.width != subsystem->width || attr.height != subsystem->height)
	{
		/* Screen size changed. Refresh monitor definitions and trigger screen resize */
		subsystem->numMonitors = x11_shadow_enum_monitors(subsystem->monitors, 16);

		shadow_screen_resize(subsystem->server->screen);

		subsystem->width = attr.width;
		subsystem->height = attr.height;

		virtualScreen = &(subsystem->virtualScreen);
		virtualScreen->left = 0;
		virtualScreen->top = 0;
		virtualScreen->right = subsystem->width;
		virtualScreen->bottom = subsystem->height;
		virtualScreen->flags = 1;

		return TRUE;
	}

	return FALSE;
}
コード例 #30
0
ファイル: xdisplay.c プロジェクト: billyquith/allegro5
static bool xdpy_create_display_hook_default(ALLEGRO_DISPLAY *display,
   int w, int h)
{
   ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
   ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display;
   (void)w;
   (void)h;

   set_initial_icon(system->x11display, d->window);

   XLockDisplay(system->x11display);

   XMapWindow(system->x11display, d->window);
   ALLEGRO_DEBUG("X11 window mapped.\n");

   d->wm_delete_window_atom = XInternAtom(system->x11display,
      "WM_DELETE_WINDOW", False);
   XSetWMProtocols(system->x11display, d->window, &d->wm_delete_window_atom, 1);

   XUnlockDisplay(system->x11display);

   d->overridable_vt = &default_overridable_vt;

   return true;
}