Esempio n. 1
0
bool haveXfixes () {
  bool result = false;
  int event_base, error_base;
  if (XFixesQueryExtension(QX11Info::display(), &event_base, &error_base)) {
    int major, minor;
    XFixesQueryVersion(QX11Info::display(), &major, &minor);
    result = (major >= 2);
  }
  return result;
}
Esempio n. 2
0
bool CursorTheme::haveXfixes()
{
    bool result = false;

#ifdef HAVE_XFIXES
    if (!QX11Info::isPlatformX11()) {
        return result;
    }
    int event_base, error_base;
    if (XFixesQueryExtension(QX11Info::display(), &event_base, &error_base))
    {
        int major, minor;
        XFixesQueryVersion(QX11Info::display(), &major, &minor);
        result = (major >= 2);
    }
#endif

    return result;
}
Esempio n. 3
0
void
_ecore_x_fixes_init(void)
{
#ifdef ECORE_XFIXES
   _fixes_major = 3;
   _fixes_minor = 0;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
     {
        _fixes_available = 1;

        ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new();
     }
   else
     _fixes_available = 0;

#else /* ifdef ECORE_XFIXES */
   _fixes_available = 0;
#endif /* ifdef ECORE_XFIXES */
}
static void
xfixes_cursor_hide (ShellXFixesCursor *xfixes_cursor)
{
  int minor, major;
  Display *xdisplay;
  Window xwindow;

  if (xfixes_cursor->is_showing == FALSE)
      return;

  if (!xfixes_cursor->have_xfixes || !xfixes_cursor->stage)
      return;

  xdisplay = clutter_x11_get_default_display ();
  xwindow = clutter_x11_get_stage_window (xfixes_cursor->stage);
  XFixesQueryVersion (xdisplay, &major, &minor);
  if (major >= 4)
    {
      XFixesHideCursor (xdisplay, xwindow);
      xfixes_cursor->is_showing = FALSE;
    }
}
Esempio n. 5
0
void stubCheckXExtensions(WindowInfo *pWindow)
{
    int evb, erb, vmi=0, vma=0;
    Display *dpy = stubGetWindowDisplay(pWindow);

    stub.bXExtensionsChecked = GL_TRUE;
    stub.trackWindowVisibleRgn = 0;

    XLOCK(dpy);
    if (XCompositeQueryExtension(dpy, &evb, &erb) 
        && XCompositeQueryVersion(dpy, &vma, &vmi) 
        && (vma>0 || vmi>=4))
    {
        stub.bHaveXComposite = GL_TRUE;
        crDebug("XComposite %i.%i", vma, vmi);
        vma=0;
        vmi=0;
        if (XFixesQueryExtension(dpy, &evb, &erb) 
            && XFixesQueryVersion(dpy, &vma, &vmi)
            && vma>=2)
        {
            crDebug("XFixes %i.%i", vma, vmi);
            stub.bHaveXFixes = GL_TRUE;
            stub.trackWindowVisibleRgn = 1;
            XUNLOCK(dpy);
            return;
        }
        else
        {
            crWarning("XFixes not found or old version (%i.%i), no VisibilityTracking", vma, vmi);
        }
    }
    else
    {
        crWarning("XComposite not found or old version (%i.%i), no VisibilityTracking", vma, vmi);
    }
    XUNLOCK(dpy);
    return;
}
Esempio n. 6
0
int x11_shadow_xfixes_init(x11ShadowSubsystem* subsystem)
{
#ifdef WITH_XFIXES
	int xfixes_event;
	int xfixes_error;
	int major, minor;

	if (!XFixesQueryExtension(subsystem->display, &xfixes_event, &xfixes_error))
		return -1;

	if (!XFixesQueryVersion(subsystem->display, &major, &minor))
		return -1;

	subsystem->xfixes_cursor_notify_event = xfixes_event + XFixesCursorNotify;

	XFixesSelectCursorInput(subsystem->display, DefaultRootWindow(subsystem->display), XFixesDisplayCursorNotifyMask);

	return 1;
#else
	return -1;
#endif
}
Esempio n. 7
0
void Extensions::init()
    {
    int event_base, error_base;
    data_nextensions = 0;
    shape_version = 0;
    if( XShapeQueryExtension( display(), &shape_event_base, &error_base ))
        {
        int major, minor;
        if( XShapeQueryVersion( display(), &major, &minor ))
            {
            shape_version = major * 0x10 + minor;
            addData( "SHAPE" );
            }
        }
#ifdef HAVE_XRANDR
    has_randr = XRRQueryExtension( display(), &randr_event_base, &error_base );
    if( has_randr )
        {
        int major, minor;
        XRRQueryVersion( display(), &major, &minor );
        has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) );
        addData( "RANDR" );
        }
#else
    has_randr = false;
#endif
#ifdef HAVE_XDAMAGE
    has_damage = XDamageQueryExtension( display(), &damage_event_base, &error_base );
    if( has_damage )
        addData( "DAMAGE" );
#else
    has_damage = false;
#endif
    composite_version = 0;
#ifdef HAVE_XCOMPOSITE
    if( XCompositeQueryExtension( display(), &event_base, &error_base ))
        {
        int major = 0, minor = 0;
        XCompositeQueryVersion( display(), &major, &minor );
        composite_version = major * 0x10 + minor;
        addData( "Composite" );
        }
#endif
    fixes_version = 0;
#ifdef HAVE_XFIXES
    if( XFixesQueryExtension( display(), &event_base, &error_base ))
        {
        int major = 0, minor = 0;
        XFixesQueryVersion( display(), &major, &minor );
        fixes_version = major * 0x10 + minor;
        addData( "XFIXES" );
        }
#endif
    render_version = 0;
#ifdef HAVE_XRENDER
    if( XRenderQueryExtension( display(), &event_base, &error_base ))
        {
        int major = 0, minor = 0;
        XRenderQueryVersion( display(), &major, &minor );
        render_version = major * 0x10 + minor;
        addData( "RENDER" );
        }
#endif
    has_glx = false;
#ifdef HAVE_OPENGL
    has_glx = glXQueryExtension( display(), &event_base, &error_base );
    if( has_glx )
        addData( "GLX" );
#endif
#ifdef HAVE_XSYNC
    if( XSyncQueryExtension( display(), &sync_event_base, &error_base ))
        {
        int major = 0, minor = 0;
        if( XSyncInitialize( display(), &major, &minor ))
            {
            has_sync = true;
            addData( "SYNC" );
            }
        }
#endif
    kDebug( 1212 ) << "Extensions: shape: 0x" << QString::number( shape_version, 16 )
        << " composite: 0x" << QString::number( composite_version, 16 )
        << " render: 0x" << QString::number( render_version, 16 )
        << " fixes: 0x" << QString::number( fixes_version, 16 ) << endl;
    }
Esempio n. 8
0
xfClipboard* xf_clipboard_new(xfContext* xfc)
{
	int n;
	UINT32 id;
	rdpChannels* channels;
	xfClipboard* clipboard;

	clipboard = (xfClipboard*) calloc(1, sizeof(xfClipboard));

	xfc->clipboard = clipboard;

	clipboard->xfc = xfc;

	channels = ((rdpContext*) xfc)->channels;
	clipboard->channels = channels;

	clipboard->system = ClipboardCreate();

	clipboard->requestedFormatId = -1;

	clipboard->root_window = DefaultRootWindow(xfc->display);
	clipboard->clipboard_atom = XInternAtom(xfc->display, "CLIPBOARD", FALSE);

	if (clipboard->clipboard_atom == None)
	{
		WLog_ERR(TAG, "unable to get CLIPBOARD atom");
		free(clipboard);
		return NULL;
	}

	id = 1;
	clipboard->property_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR", FALSE);
	clipboard->identity_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR_ID", FALSE);

	XChangeProperty(xfc->display, xfc->drawable, clipboard->identity_atom,
			XA_INTEGER, 32, PropModeReplace, (BYTE*) &id, 1);

	XSelectInput(xfc->display, clipboard->root_window, PropertyChangeMask);

#ifdef WITH_XFIXES
	if (XFixesQueryExtension(xfc->display, &clipboard->xfixes_event_base, &clipboard->xfixes_error_base))
	{
		int xfmajor, xfminor;

		if (XFixesQueryVersion(xfc->display, &xfmajor, &xfminor))
		{
			XFixesSelectSelectionInput(xfc->display, clipboard->root_window,
				clipboard->clipboard_atom, XFixesSetSelectionOwnerNotifyMask);
			clipboard->xfixes_supported = TRUE;
		}
		else
		{
			WLog_ERR(TAG, "Error querying X Fixes extension version");
		}
	}
	else
	{
		WLog_ERR(TAG, "Error loading X Fixes extension");
	}
#else
	WLog_ERR(TAG, "Warning: Using clipboard redirection without XFIXES extension is strongly discouraged!");
#endif

	n = 0;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "_FREERDP_RAW", False);
	clipboard->clientFormats[n].formatId = 0;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "UTF8_STRING", False);
	clipboard->clientFormats[n].formatId = CF_UNICODETEXT;
	n++;

	clipboard->clientFormats[n].atom = XA_STRING;
	clipboard->clientFormats[n].formatId = CF_TEXT;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/png", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_PNG;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/jpeg", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_JPEG;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/gif", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_GIF;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/bmp", False);
	clipboard->clientFormats[n].formatId = CF_DIB;
	n++;

	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "text/html", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_HTML;
	clipboard->clientFormats[n].formatName = _strdup("HTML Format");
	if (!clipboard->clientFormats[n].formatName)
	{
		ClipboardDestroy(clipboard->system);
		free(clipboard);
		return NULL;
	}
	n++;

	clipboard->numClientFormats = n;

	clipboard->targets[0] = XInternAtom(xfc->display, "TIMESTAMP", FALSE);
	clipboard->targets[1] = XInternAtom(xfc->display, "TARGETS", FALSE);
	clipboard->numTargets = 2;

	clipboard->incr_atom = XInternAtom(xfc->display, "INCR", FALSE);

	return clipboard;
}
Esempio n. 9
0
xfClipboard* xf_clipboard_new(xfContext* xfc)
{
	int i, n = 0;
	rdpChannels* channels;
	xfClipboard* clipboard;

	if (!(clipboard = (xfClipboard*) calloc(1, sizeof(xfClipboard))))
	{
		WLog_ERR(TAG, "failed to allocate xfClipboard data");
		return NULL;
	}

	xfc->clipboard = clipboard;
	clipboard->xfc = xfc;
	channels = ((rdpContext*) xfc)->channels;
	clipboard->channels = channels;
	clipboard->system = ClipboardCreate();
	clipboard->requestedFormatId = -1;
	clipboard->root_window = DefaultRootWindow(xfc->display);
	clipboard->clipboard_atom = XInternAtom(xfc->display, "CLIPBOARD", FALSE);

	if (clipboard->clipboard_atom == None)
	{
		WLog_ERR(TAG, "unable to get CLIPBOARD atom");
		goto error;
	}

	clipboard->property_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR", FALSE);
	clipboard->raw_transfer_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR_RAW", FALSE);
	clipboard->raw_format_list_atom =
	    XInternAtom(xfc->display, "_FREERDP_CLIPRDR_FORMATS", FALSE);
	xf_cliprdr_set_raw_transfer_enabled(clipboard, TRUE);
	XSelectInput(xfc->display, clipboard->root_window, PropertyChangeMask);
#ifdef WITH_XFIXES

	if (XFixesQueryExtension(xfc->display, &clipboard->xfixes_event_base,
	                         &clipboard->xfixes_error_base))
	{
		int xfmajor, xfminor;

		if (XFixesQueryVersion(xfc->display, &xfmajor, &xfminor))
		{
			XFixesSelectSelectionInput(xfc->display, clipboard->root_window,
			                           clipboard->clipboard_atom, XFixesSetSelectionOwnerNotifyMask);
			clipboard->xfixes_supported = TRUE;
		}
		else
		{
			WLog_ERR(TAG, "Error querying X Fixes extension version");
		}
	}
	else
	{
		WLog_ERR(TAG, "Error loading X Fixes extension");
	}

#else
	WLog_ERR(TAG,
	         "Warning: Using clipboard redirection without XFIXES extension is strongly discouraged!");
#endif
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "_FREERDP_RAW", False);
	clipboard->clientFormats[n].formatId = CF_RAW;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "UTF8_STRING", False);
	clipboard->clientFormats[n].formatId = CF_UNICODETEXT;
	n++;
	clipboard->clientFormats[n].atom = XA_STRING;
	clipboard->clientFormats[n].formatId = CF_TEXT;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/png", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_PNG;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/jpeg", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_JPEG;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/gif", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_GIF;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "image/bmp", False);
	clipboard->clientFormats[n].formatId = CF_DIB;
	n++;
	clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "text/html", False);
	clipboard->clientFormats[n].formatId = CB_FORMAT_HTML;
	clipboard->clientFormats[n].formatName = _strdup("HTML Format");

	if (!clipboard->clientFormats[n].formatName)
		goto error;

	n++;

	/*
	 * Existence of registered format IDs for file formats does not guarantee that they are
	 * in fact supported by wClipboard (as further initialization may have failed after format
	 * registration). However, they are definitely not supported if there are no registered
	 * formats. In this case we should not list file formats in TARGETS.
	 */
	if (ClipboardGetFormatId(clipboard->system, "text/uri-list"))
	{
		clipboard->file_formats_registered = TRUE;
		clipboard->clientFormats[n].atom = XInternAtom(xfc->display, "text/uri-list", False);
		clipboard->clientFormats[n].formatId = CB_FORMAT_TEXTURILIST;
		clipboard->clientFormats[n].formatName = _strdup("FileGroupDescriptorW");

		if (!clipboard->clientFormats[n].formatName)
			goto error;

		n++;
	}

	clipboard->numClientFormats = n;
	clipboard->targets[0] = XInternAtom(xfc->display, "TIMESTAMP", FALSE);
	clipboard->targets[1] = XInternAtom(xfc->display, "TARGETS", FALSE);
	clipboard->numTargets = 2;
	clipboard->incr_atom = XInternAtom(xfc->display, "INCR", FALSE);
	clipboard->delegate = ClipboardGetDelegate(clipboard->system);
	clipboard->delegate->custom = clipboard;
	clipboard->delegate->ClipboardFileSizeSuccess = xf_cliprdr_clipboard_file_size_success;
	clipboard->delegate->ClipboardFileSizeFailure = xf_cliprdr_clipboard_file_size_failure;
	clipboard->delegate->ClipboardFileRangeSuccess = xf_cliprdr_clipboard_file_range_success;
	clipboard->delegate->ClipboardFileRangeFailure = xf_cliprdr_clipboard_file_range_failure;
	return clipboard;
error:

	for (i = 0; i < n; i++)
		free(clipboard->clientFormats[i].formatName);

	ClipboardDestroy(clipboard->system);
	free(clipboard);
	return NULL;
}