Пример #1
1
ClipboardPoll::ClipboardPoll()
    : xfixes_event_base( -1 )
{
    hide();
    const char* names[ 6 ]
        = { "_QT_SELECTION_SENTINEL",
            "_QT_CLIPBOARD_SENTINEL",
            "CLIPBOARD",
            "TIMESTAMP",
            "KLIPPER_SELECTION_TIMESTAMP",
            "KLIPPER_CLIPBOARD_TIMESTAMP" };
    Atom atoms[ 6 ];
    XInternAtoms( QX11Info::display(), const_cast< char** >( names ), 6, False, atoms );
    selection.sentinel_atom = atoms[ 0 ];
    clipboard.sentinel_atom = atoms[ 1 ];
    xa_clipboard = atoms[ 2 ];
    xa_timestamp = atoms[ 3 ];
    selection.timestamp_atom = atoms[ 4 ];
    clipboard.timestamp_atom = atoms[ 5 ];
    bool use_polling = true;
    kapp->installX11EventFilter( this );
    timer.setSingleShot( false );
#ifdef HAVE_XFIXES
    int dummy;
    if( XFixesQueryExtension( QX11Info::display(), &xfixes_event_base, &dummy ))
    {
        XFixesSelectSelectionInput( QX11Info::display(), QX11Info::appRootWindow( 0 ), XA_PRIMARY,
            XFixesSetSelectionOwnerNotifyMask |
            XFixesSelectionWindowDestroyNotifyMask |
            XFixesSelectionClientCloseNotifyMask );
        XFixesSelectSelectionInput( QX11Info::display(), QX11Info::appRootWindow( 0 ), xa_clipboard,
            XFixesSetSelectionOwnerNotifyMask |
            XFixesSelectionWindowDestroyNotifyMask |
            XFixesSelectionClientCloseNotifyMask );
        use_polling = false;
#ifdef NOISY_KLIPPER_
            kDebug() << "Using XFIXES";
#endif
    }
#endif
    if( use_polling )
        {
#ifdef NOISY_KLIPPER_
        kDebug() << "Using polling";
#endif
        initPolling();
        }
}
Пример #2
0
static void create_atoms( Display* dpy ) {
    if (!atoms_created){
	const int max = 20;
	Atom* atoms[max];
	const char* names[max];
	Atom atoms_return[max];
	int n = 0;

	atoms[n] = &kde_wm_change_state;
	names[n++] = "_KDE_WM_CHANGE_STATE";

        atoms[n] = &_wm_protocols;
        names[n++] = "WM_PROTOCOLS";

        atoms[n] = &kwm_utf8_string;
        names[n++] = "UTF8_STRING";

        char net_wm_cm_name[ 100 ];
        sprintf( net_wm_cm_name, "_NET_WM_CM_S%d", DefaultScreen( dpy ));
        atoms[n] = &net_wm_cm;
        names[n++] = net_wm_cm_name;

	// we need a const_cast for the shitty X API
	XInternAtoms( dpy, const_cast<char**>(names), n, false, atoms_return );
	for (int i = 0; i < n; i++ )
	    *atoms[i] = atoms_return[i];

	atoms_created = True;
    }
}
Пример #3
0
nsresult
XRemoteClient::Init()
{
  PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::Init"));

  if (mInitialized)
    return NS_OK;

  // try to open the display
  mDisplay = XOpenDisplay(0);
  if (!mDisplay)
    return NS_ERROR_FAILURE;

  // get our atoms
  XInternAtoms(mDisplay, const_cast<char**>(XAtomNames),
               ARRAY_LENGTH(XAtomNames), False, XAtoms);

  int i = 0;
  mMozVersionAtom  = XAtoms[i++];
  mMozLockAtom     = XAtoms[i++];
  mMozResponseAtom = XAtoms[i++];
  mMozWMStateAtom  = XAtoms[i++];
  mMozUserAtom     = XAtoms[i++];
  mMozProfileAtom  = XAtoms[i++];
  mMozProgramAtom  = XAtoms[i++];
  mMozCommandLineAtom = XAtoms[i++];

  mInitialized = true;

  return NS_OK;
}
Пример #4
0
int
InitTray(Display* dpy, TrayWindow* tray)
{
    char *atom_names[] = {
        NULL,
        "MANAGER",
        "_NET_SYSTEM_TRAY_OPCODE",
        "_NET_SYSTEM_TRAY_ORIENTATION",
        "_NET_SYSTEM_TRAY_VISUAL"
    };

    asprintf(&atom_names[0], "_NET_SYSTEM_TRAY_S%d", tray->owner->iScreen);

    XInternAtoms(dpy, atom_names, 5, False, tray->atoms);
    tray->size = 22;

    free(atom_names[0]);

    XWindowAttributes attr;
    XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attr);
    if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
        XSelectInput(dpy, DefaultRootWindow(dpy), attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
    }
    return True;
}
Пример #5
0
void remove_sm_from_client_leader()
{
#ifdef Q_WS_X11
  Atom type;
  int format, status;
  unsigned long nitems = 0;
  unsigned long extra = 0;
  unsigned char *data = 0;

  Atom atoms[ 2 ];
  char *atom_names[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
                            ( char * ) "SM_CLIENT_ID" };

  XInternAtoms( QX11Info::display(), atom_names, 2, False, atoms );

  QWidget w;
  KXErrorHandler handler; // ignore X errors
  status = XGetWindowProperty( QX11Info::display(), w.winId(), atoms[ 0 ], 0,
                               10000, false, XA_WINDOW, &type, &format, &nitems,
                               &extra, &data );

  if ( ( status == Success ) && !handler.error( false ) ) {
      if ( data && ( nitems > 0 ) ) {
          Window leader = * ( ( Window * ) data );
          XDeleteProperty( QX11Info::display(), leader, atoms[ 1 ] );
      }
      XFree( data );
  }
#endif
}
Пример #6
0
void GHOST_DropTargetX11::Initialize(void)
{
    Display *display = m_system->getXDisplay();
    int dndTypesCount = sizeof(m_dndMimeTypes) / sizeof(char*);
    int counter;

    xdnd_init(&m_dndClass, display);

    m_dndTypes = new Atom[dndTypesCount + 1];
    XInternAtoms(display, (char**)m_dndMimeTypes, dndTypesCount, 0, m_dndTypes);
    m_dndTypes[dndTypesCount] = 0;

    m_dndActions = new Atom[8];
    counter = 0;

    m_dndActions[counter++] = m_dndClass.XdndActionCopy;
    m_dndActions[counter++] = m_dndClass.XdndActionMove;

#if 0 /* Not supported yet */
    dndActions[counter++] = dnd->XdndActionLink;
    dndActions[counter++] = dnd->XdndActionAsk;
    dndActions[counter++] = dnd->XdndActionPrivate;
    dndActions[counter++] = dnd->XdndActionList;
    dndActions[counter++] = dnd->XdndActionDescription;
#endif

    m_dndActions[counter++] = 0;
}
Пример #7
0
void CompMgrClient::create_X11_atoms() {
#ifdef Q_WS_X11
    m_createdAtoms = true;
    const int max = 20;
    Atom* atoms[max];
    const char* names[max];
    Atom atoms_return[max];
    int n = 0;

    atoms[n] = &skim_wm_window_opacity;
    if(m_useKompmgr)
        names[n++] = (char*) "_KDE_WM_WINDOW_OPACITY";
    else
        names[n++] = (char*) "_NET_WM_WINDOW_OPACITY";

    atoms[n] = &skim_wm_window_shadow;
    names[n++] = (char*) "_KDE_WM_WINDOW_SHADOW";

    // we need a const_cast for the X API
    XInternAtoms( qt_xdisplay(), const_cast<char**>(names), n, false, atoms_return );
    for (int i = 0; i < n; i++ )
        *atoms[i] = atoms_return[i];

#endif
}
Пример #8
0
int main(int argc, const char** argv)
{
	XInitThreads();
	s_display = XOpenDisplay(0);

	int32_t screen = DefaultScreen(s_display);
	int32_t depth = DefaultDepth(s_display, screen);
	Visual* visual = DefaultVisual(s_display, screen);
	Window root = RootWindow(s_display, screen);

	XSetWindowAttributes windowAttrs = { 0 };
	windowAttrs.background_pixmap = 0;
	windowAttrs.border_pixel = 0;
	windowAttrs.event_mask = 0
			| ButtonPressMask
			| ButtonReleaseMask
			| ExposureMask
			| KeyPressMask
			| KeyReleaseMask
			| PointerMotionMask
			| ResizeRedirectMask
			| StructureNotifyMask
			;

	int width = 800;
	int height = 600;

	s_window = XCreateWindow(s_display
							, root
							, 0, 0
							, width, height, 0, depth
							, InputOutput
							, visual
							, CWBorderPixel|CWEventMask
							, &windowAttrs
							);

	// Clear window to black.
	XSetWindowAttributes attr = { 0 };
	XChangeWindowAttributes(s_display, s_window, CWBackPixel, &attr);

	const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
	XInternAtoms(s_display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow);
	XSetWMProtocols(s_display, s_window, &wmDeleteWindow, 1);

	XMapWindow(s_display, s_window);
	XStoreName(s_display, s_window, "ProDBG");

	bgfx::x11SetDisplayWindow(s_display, s_window);
    
    ProDBG_create((void*)s_window, width, height);

	processEvents();

	XUnmapWindow(s_display, s_window);
	XDestroyWindow(s_display, s_window);

	return EXIT_SUCCESS;
}
Пример #9
0
static void
initialize (Display *dpy)
{
  if (initialized)
    return;

  XInternAtoms (dpy, atom_names, sizeof (atoms) / sizeof (atoms[0]), False, atoms);

  initialized = TRUE;
}
Пример #10
0
void KWinSelectionOwner::getAtoms()
{
    KSelectionOwner::getAtoms();
    if(xa_version == None)
    {
        Atom atoms[1];
        const char *const names[] = {"VERSION"};
        XInternAtoms(qt_xdisplay(), const_cast< char ** >(names), 1, False, atoms);
        xa_version = atoms[0];
    }
}
Пример #11
0
static void initAtoms()
{
    char nm[100];
    sprintf(nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen(qt_xdisplay()));
    char nm2[] = "_KDE_TOPMENU_MINSIZE";
    char *names[2] = {nm, nm2};
    Atom atoms[2];
    XInternAtoms(qt_xdisplay(), names, 2, False, atoms);
    selection_atom = atoms[0];
    msg_type_atom = atoms[1];
}
Пример #12
0
void
AtomListIntern(const char *const *names, unsigned int num, unsigned int *atoms)
{
#if SIZEOF_INT == SIZEOF_LONG
   XInternAtoms(disp, (char **)names, num, False, (Atom *) atoms);
#else
   unsigned int        i;
   Atom               *_atoms;

   _atoms = EMALLOC(Atom, num);
   if (!_atoms)
      return;

   XInternAtoms(disp, (char **)names, num, False, _atoms);
   for (i = 0; i < num; i++)
      atoms[i] = _atoms[i];

   Efree(_atoms);
#endif
}
Пример #13
0
static void
init(Display *d) { /* Hrm... assumes one display... */
	char *toks[nelem(types)];
	char *s, *p;
	long n;
	int i;

	xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY);
	if(xlib == nil)
		return;
	mapwindow = (mapfn)(uintptr_t)dlsym(xlib, "XMapWindow");
	mapraised = (mapfn)(uintptr_t)dlsym(xlib, "XMapRaised");

	unsetenv("LD_PRELOAD");

	if((s = getenv("WMII_HACK_TRANSIENT"))) {
		if(getlong(s, &n))
			transient = n;
		unsetenv("WMII_HACK_TRANSIENT");
	}
	if((s = getenv("WMII_HACK_TYPE"))) {
		s = strdup(s);
		unsetenv("WMII_HACK_TYPE");

		n = tokenize(toks, nelem(toks), s, ',');
		for(i=0; i < n; i++) {
			for(p=toks[i]; *p; p++)
				if(*p >= 'a' && *p <= 'z')
					*p += 'A' - 'a';
			toks[i] = smprint("_NET_WM_WINDOW_TYPE_%s", toks[i]);
		}
		XInternAtoms(d, toks, n, false, types);
		ntypes = n;
		for(i=0; i < n; i++)
			free(toks[i]);
		free(s);
	}
	if((s = getenv("WMII_HACK_TAGS"))) {
		s = strdup(s);
		unsetenv("WMII_HACK_TAGS");

		n = tokenize(toks, nelem(toks)-1, s, '+');
		tags = strlistdup(toks, n);
		free(s);
	}
	if((s = getenv("WMII_HACK_TIME"))) {
		getlong(s, &stime);
		unsetenv("WMII_HACK_TIME");
	}

	pid = getpid();
	gethostname(hostname, sizeof hostname - 1);
}
Пример #14
0
static int setup_display() {
	int depth, i, formatCount, convDepth = -1;
	XPixmapFormatValues* formats;

	if (s_setup_done) {
		return 1;
	}

	s_display = XOpenDisplay(0);

	if (!s_display) {
		printf("Unable to open X11 display\n");
		return 0;
	}

	s_context = XUniqueContext();
	s_screen = DefaultScreen(s_display);
	s_visual = DefaultVisual(s_display, s_screen);
	formats = XListPixmapFormats(s_display, &formatCount);
	depth = DefaultDepth(s_display, s_screen);

	for (i = 0; i < formatCount; ++i) {
		if (depth == formats[i].depth) {
			convDepth = formats[i].bits_per_pixel;
			break;
		}
	}
  
	XFree(formats);

	// We only support 32-bit right now
	if (convDepth != 32) {
		printf("Unable to find 32-bit format for X11 display\n");
		XCloseDisplay(s_display);
		return 0;
	}

	s_depth = depth;

	s_gc = DefaultGC(s_display, s_screen);

	s_screen_width = DisplayWidth(s_display, s_screen);
	s_screen_height = DisplayHeight(s_display, s_screen);

	const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
    XInternAtoms(s_display, (char**)&wmDeleteWindowName, 1, False, &s_wm_delete_window);

	s_setup_done = 1;

	return 1;
}
Пример #15
0
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
X11GUIFactory::X11GUIFactory(const char* displayname)
: xdisplay(0)
, xvisualinfo(0)
, xfont(0)
{
  // Open one display connection for all RGL X11 devices
  xdisplay = XOpenDisplay(displayname);
  
  if (xdisplay == 0) {
    throw_error("unable to open X11 display"); return;
  }
  
  // Load System font
  xfont = XLoadFont(xdisplay,"fixed");

  // Obtain display atoms
  static char* atom_names[GUI_X11_ATOM_LAST] = {
    "WM_DELETE_WINDOW"
  };
  Status s = XInternAtoms(xdisplay, atom_names, sizeof(atom_names)/sizeof(char*), True, atoms);

  if (!s)
    lib::printMessage("some atoms not available");
  
  // Query glx extension
   
  if ( glXQueryExtension(xdisplay, &errorBase, &eventBase) == False ) {
    throw_error("GLX extension missing on server"); return;
  }
  
  // Choose GLX visual
  
  static int attribList[] =
  {
    GLX_RGBA,
    GLX_DOUBLEBUFFER,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_ALPHA_SIZE, 0,
    GLX_DEPTH_SIZE, 1,
    None
  };

  xvisualinfo = glXChooseVisual( xdisplay, DefaultScreen(xdisplay), attribList );
  if (xvisualinfo == 0) {
    throw_error("no suitable visual available"); return;
  }
}
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
  CEF_REQUIRE_UI_THREAD();

  std::string titleStr(title);

  if (!browser->IsPopup()) {
    // Set the GTK parent window title.
    GtkWidget* window = gtk_widget_get_ancestor(main_handle_,
        GTK_TYPE_WINDOW);
    gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
  } else {
    // Retrieve the X11 display shared with Chromium.
    ::Display* display = cef_get_xdisplay();
    DCHECK(display);

    // Retrieve the X11 window handle for the browser.
    ::Window window = browser->GetHost()->GetWindowHandle();
    DCHECK(window != kNullWindowHandle);

    // Retrieve the atoms required by the below XChangeProperty call.
    const char* kAtoms[] = {
      "_NET_WM_NAME",
      "UTF8_STRING"
    };
    Atom atoms[2];
    int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
                              atoms);
    if (!result)
      NOTREACHED();

    // Set the window title.
    XChangeProperty(display,
                    window,
                    atoms[0],
                    atoms[1],
                    8,
                    PropModeReplace,
                    reinterpret_cast<const unsigned char*>(titleStr.c_str()),
                    titleStr.size());

    // TODO(erg): This is technically wrong. So XStoreName and friends expect
    // this in Host Portable Character Encoding instead of UTF-8, which I
    // believe is Compound Text. This shouldn't matter 90% of the time since
    // this is the fallback to the UTF8 property above.
    XStoreName(display, browser->GetHost()->GetWindowHandle(),
               titleStr.c_str());
  }
}
Пример #17
0
static void initX()
{
	/* open connection to X server */
	X.display = XOpenDisplay(0);
	if (!X.display)
		LOG_ERROR("failed connect to X server\n");
	XSetErrorHandler(X_error_handler);
	XSetIOErrorHandler(X_io_error_handler);
	
	memset(&X.attrs, 0, sizeof(X.attrs));

	/* useful variables */
	X.screen 	= DefaultScreen(X.display);
	X.screen_width 	= DisplayWidth(X.display, X.screen);
	X.screen_height	= DisplayHeight(X.display, X.screen);
	X.visual 	= DefaultVisual(X.display, X.screen);
	X.colmap	= CopyFromParent;
	X.root 		= RootWindow(X.display, X.screen);
	X.amask		= 0;
	X.depth 	= DefaultDepth(X.display, X.screen);
	X.wa_x 		= 0;
	X.wa_y 		= 0;
	X.wa_w 		= X.screen_width;
	X.wa_h 		= X.screen_height;
	
	/* get internal atoms */
	XInternAtoms(X.display, atom_names, XATOM_COUNT, False, X.atoms);
	XSelectInput( X.display
              , X.root
              , PropertyChangeMask 
              | ButtonPressMask 
              | KeyPressMask 
              | ExposureMask
              | FocusChangeMask 
              | StructureNotifyMask
              );

	/* append_font_path_to_imlib(); */

	/* get workarea */
	int32_t *workarea = get_prop_data(X.root, X.atoms[XATOM_NET_WORKAREA], XA_CARDINAL, 0);
	if (workarea) {
		X.wa_x = workarea[0];
		X.wa_y = workarea[1];
		X.wa_w = workarea[2];
		X.wa_h = workarea[3];
		XFree(workarea);	
	}
}
Пример #18
0
EAPI void
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
{
   Atom *atoms_int;
   int i;

   if (!_ecore_x_disp)
      return;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   atoms_int = alloca(num * sizeof(Atom));
   XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
   for (i = 0; i < num; i++)
      atoms[i] = atoms_int[i];
} /* ecore_x_atoms_get */
Пример #19
0
void
_ecore_x_atoms_init(void)
{
   Atom *atoms;
   char **names;
   int i, num;

   num = sizeof(atom_items) / sizeof(Atom_Item);
   atoms = alloca(num * sizeof(Atom));
   names = alloca(num * sizeof(char *));
   for (i = 0; i < num; i++)
     names[i] = (char *) atom_items[i].name;
   XInternAtoms(_ecore_x_disp, names, num, False, atoms);
   for (i = 0; i < num; i++)
     *(atom_items[i].atom) = atoms[i];
}
Пример #20
0
void
_gdk_x11_precache_atoms (GdkDisplay          *display,
			 const gchar * const *atom_names,
			 gint                 n_atoms)
{
  Atom *xatoms;
  GdkAtom *atoms;
  const gchar **xatom_names;
  gint n_xatoms;
  gint i;

  xatoms = g_new (Atom, n_atoms);
  xatom_names = g_new (const gchar *, n_atoms);
  atoms = g_new (GdkAtom, n_atoms);

  n_xatoms = 0;
  for (i = 0; i < n_atoms; i++)
    {
      GdkAtom atom = gdk_atom_intern_static_string (atom_names[i]);
      if (lookup_cached_xatom (display, atom) == None)
	{
	  atoms[n_xatoms] = atom;
	  xatom_names[n_xatoms] = atom_names[i];
	  n_xatoms++;
	}
    }

  if (n_xatoms)
    {
#ifdef HAVE_XINTERNATOMS
      XInternAtoms (GDK_DISPLAY_XDISPLAY (display),
		    (char **)xatom_names, n_xatoms, False, xatoms);
#else
      for (i = 0; i < n_xatoms; i++)
	xatoms[i] = XInternAtom (GDK_DISPLAY_XDISPLAY (display),
				 xatom_names[i], False);
#endif
    }

  for (i = 0; i < n_xatoms; i++)
    insert_atom_pair (display, atoms[i], xatoms[i]);

  g_free (xatoms);
  g_free (xatom_names);
  g_free (atoms);
}
Пример #21
0
static int init_x11_atoms()
{
    char *atom_names[] = {
#define GLWT_X11_ATOM_NAME(X) #X,
        GLWT_X11_ATOMS(GLWT_X11_ATOM_NAME)
#undef GLWT_X11_ATOM_NAME
    };

    int num_atoms = sizeof(atom_names)/sizeof(*atom_names);

    if(XInternAtoms(glwt.x11.display, atom_names, num_atoms, False, (Atom*)&glwt.x11.atoms) == 0)
    {
        glwtErrorPrintf("XInternAtoms failed");
        return -1;
    }

    return 0;
}
Пример #22
0
static void
set_above_and_fullscreen (void)
{
  Display *dpy = clutter_x11_get_default_display ();
  Window win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
  char *atom_names[2] = {
    "_NET_WM_STATE_FULLSCREEN",
    "_NET_WM_STATE_ABOVE",
  };
  Atom states[G_N_ELEMENTS (atom_names)];

  XInternAtoms (dpy, atom_names, G_N_ELEMENTS (atom_names),
                False, states);

  XChangeProperty (dpy, win,
                   XInternAtom (dpy, "_NET_WM_STATE", False),
                   XA_ATOM, 32, PropModeReplace,
                   (unsigned char *) states, G_N_ELEMENTS (atom_names));
}
Пример #23
0
void
property_initialize(void)
{
    size_t i;
    
#if XlibSpecificationRelease >= 6
    if (!XInternAtoms(DISP, atom_names, XtNumber(atom_names), False, atoms))
	XDVI_FATAL((stderr, "XtInternAtoms failed."));
#else
    for (i = 0; i < XtNumber(atom_names); i++) {
	if ((atoms[i] = XInternAtom(DISP, atom_names[i], False)) == None)
	    XDVI_FATAL((stderr, "XtInternAtoms failed."));
    }
#endif

    if (globals.debug & DBG_CLIENT) {
	for (i = 0; i < XtNumber(atom_names); i++)
	    TRACE_CLIENT((stderr, "Atom(%s) = %lu", atom_names[i], atoms[i]));
    }
}
Пример #24
0
	XHelper() :
		wmInf_(),
		acquireCount_(0)
	{
		acquire();

		// Intern some atoms;
		const char* atoms[] = {
			"CLIPBOARD",
			"TEXT",
			"COMPOUND_TEXT",
			"UTF8_STRING",
			"WESNOTH_PASTE",
			"TARGETS"
		};

		XInternAtoms(dpy(), const_cast<char**>(reinterpret_cast<const char**>(atoms)), 6, false, atomTable_);

		release();
	}
Пример #25
0
static void
PDMPhase2Handler(Widget w,
		 XtPointer data,
		 XEvent *event,
		 Boolean *cont)
{
    enum { XmAPDM_REPLY, XmAPDM_EXIT_OK, XmAPDM_EXIT_ERROR,
	   XmAPDM_EXIT_CANCEL, NUM_ATOMS };
    static char *atom_names[] =
      { XmIPDM_REPLY, XmIPDM_EXIT_OK, XmIPDM_EXIT_ERROR, XmIPDM_EXIT_CANCEL };

    XmPrintShellWidget print_shell = (XmPrintShellWidget) w ;
    XmPrintShellCallbackStruct pr_cbs ;
    XClientMessageEvent * xevent = (XClientMessageEvent *) event;
    Atom atoms[XtNumber(atom_names)];

    assert(XtNumber(atom_names) == NUM_ATOMS);
    XInternAtoms(XtDisplay(print_shell), atom_names, XtNumber(atom_names), 
		 False, atoms);

    if (xevent->type == ClientMessage &&
	xevent->message_type == atoms[XmAPDM_REPLY]) {

	/* check for the exit status of the PDM */
	if (xevent->data.l[0] == atoms[XmAPDM_EXIT_OK])
	    pr_cbs.reason = XmCR_PDM_OK ;
	else 
	if (xevent->data.l[0] == atoms[XmAPDM_EXIT_CANCEL])
	    pr_cbs.reason = XmCR_PDM_CANCEL ;
	else 
	if (xevent->data.l[0] == atoms[XmAPDM_EXIT_ERROR])
	    pr_cbs.reason = XmCR_PDM_EXIT_ERROR ;
	    /* some error message might have been logged */

	XtCallCallbackList (w, print_shell->print.pdm_notification_callback, 
			    &pr_cbs);
    }

    /* remove me */
    XtAddEventHandler(w, (EventMask) 0, True, PDMPhase2Handler, NULL);
}
Пример #26
0
/**
 * meta_compositor_new: (skip)
 *
 */
MetaCompositor *
meta_compositor_new (MetaDisplay *display)
{
    char *atom_names[] = {
        "_XROOTPMAP_ID",
        "_XSETROOT_ID",
        "_NET_WM_WINDOW_OPACITY",
    };
    Atom                   atoms[G_N_ELEMENTS(atom_names)];
    MetaCompositor        *compositor;
    Display               *xdisplay = meta_display_get_xdisplay (display);

    if (!composite_at_least_version (display, 0, 3))
        return NULL;

    compositor = g_new0 (MetaCompositor, 1);

    compositor->display = display;

    if (g_getenv("META_DISABLE_MIPMAPS"))
        compositor->no_mipmaps = TRUE;

    meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
    XInternAtoms (xdisplay, atom_names, G_N_ELEMENTS (atom_names),
                  False, atoms);

    g_signal_connect (meta_shadow_factory_get_default (),
                      "changed",
                      G_CALLBACK (on_shadow_factory_changed),
                      compositor);

    compositor->atom_x_root_pixmap = atoms[0];
    compositor->atom_x_set_root = atoms[1];
    compositor->atom_net_wm_window_opacity = atoms[2];

    compositor->repaint_func_id = clutter_threads_add_repaint_func (meta_repaint_func,
                                  compositor,
                                  NULL);

    return compositor;
}
Пример #27
0
void Blackbox::init_icccm(void) {
  char* atoms[7] = {
    "WM_COLORMAP_WINDOWS",
    "WM_PROTOCOLS",
    "WM_STATE",
    "WM_CHANGE_STATE",
    "WM_DELETE_WINDOW",
    "WM_TAKE_FOCUS",
    "_MOTIF_WM_HINTS"
  };
  Atom atoms_return[7];
  XInternAtoms(XDisplay(), atoms, 7, false, atoms_return);
  xa_wm_colormap_windows = atoms_return[0];
  xa_wm_protocols = atoms_return[1];
  xa_wm_state = atoms_return[2];
  xa_wm_change_state = atoms_return[3];
  xa_wm_delete_window = atoms_return[4];
  xa_wm_take_focus = atoms_return[5];
  motif_wm_hints = atoms_return[6];

  _ewmh = new bt::EWMH(display());
}
Пример #28
0
static void kis_x11_create_intern_atoms()
{
    const char *names[KisX11Data::NAtoms];
    const char *ptr = kis_x11_atomnames;

    int i = 0;
    while (*ptr) {
        names[i++] = ptr;
        while (*ptr)
            ++ptr;
        ++ptr;
    }

    Q_ASSERT(i == KisX11Data::NPredefinedAtoms);
    Q_ASSERT(i == KisX11Data::NAtoms);

#if defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6)
    XInternAtoms(KIS_X11->display, (char **)names, i, False, KIS_X11->atoms);
#else
    for (i = 0; i < KisX11Data::NAtoms; ++i)
        KIS_X11->atoms[i] = XInternAtom(KIS_X11->display, (char *)names[i], False);
#endif
}
Пример #29
0
void
ServiceMgr::create_atoms()
{
  static Boolean created = False;

  if (!created)
    {
      enum { XA_OLIAS_WINDOW_ID_ATOM, XA_OLIAS_EVENT_ATOM,
	     XA_OLIAS_REPLY_ATOM, NUM_ATOMS }; 
      static const char *atom_names[] = { OLIAS_WINDOW_ID_ATOM,
	     OLIAS_EVENT_ATOM, OLIAS_REPLY_ATOM };

      Atom atoms[XtNumber(atom_names)];

      XInternAtoms (window_system().display(), (char**)atom_names,
		    XtNumber((char**)atom_names), False, atoms);

      _XA_OLIAS_WINDOW_ID = atoms[XA_OLIAS_WINDOW_ID_ATOM];
      _XA_OLIAS_EVENT = atoms[XA_OLIAS_EVENT_ATOM];
      _XA_OLIAS_REPLY = atoms[XA_OLIAS_REPLY_ATOM];

      created = True;
    }
}
Пример #30
0
WSMDispInfo *
_WSMGetDispInfo(Display *dpy)
{
    enum { XA_WSM_NAME_CONNECT, XA_WSM_NAME_EXTENSIONS, XA_WSM_NAME_CONFIG_FMT,
           XA_WSM_NAME_GET_STATE, XA_WSM_NAME_SET_STATE, XA_WSM_NAME_REG_WINDOW,
           XA_WSM_NAME_WM_GET_BACKGROUND_WINDOW,
           XA_WSM_NAME_WM_SET_BACKGROUND_WINDOW, XA_WSM_NAME_WM_WINDOWS,
           XA_WSM_NAME_WM_FOCUS, XA_WSM_NAME_WM_POINTER, XA_TARGETS,
           XA_MULTIPLE, XA_TIMESTAMP, NUM_ATOMS
         };
    static char *atom_names[] = {
        WSM_NAME_CONNECT, WSM_NAME_EXTENSIONS, WSM_NAME_CONFIG_FMT,
        WSM_NAME_GET_STATE, WSM_NAME_SET_STATE, WSM_NAME_REG_WINDOW,
        WSM_NAME_WM_GET_BACKGROUND_WINDOW,
        WSM_NAME_WM_SET_BACKGROUND_WINDOW, WSM_NAME_WM_WINDOWS,
        WSM_NAME_WM_FOCUS, WSM_NAME_WM_POINTER, "TARGETS",
        "MULTIPLE", "TIMESTAMP"
    };

    WSMDispInfo * disp_info;
    Atom atoms[XtNumber(atom_names)];

    if (GDispInfo == NULL) {
        disp_info = GDispInfo = (WSMDispInfo *) XtMalloc(sizeof(WSMDispInfo));
    }
    else {
        disp_info = GDispInfo;

        while (True) {
            if (disp_info->disp == dpy)
                return(disp_info);

            if (disp_info->next == NULL)
                break;

            disp_info = disp_info->next;
        }

        /*
         * This display is not on the global list, add it.
         */

        disp_info->next = (WSMDispInfo *) XtMalloc(sizeof(WSMDispInfo));
        disp_info = disp_info->next;
    }

    disp_info->disp = dpy;

    /*
     * These are our names.
     *
     * ||| Should use XtConvertAndStore().
     */

    XInternAtoms(dpy, atom_names, XtNumber(atom_names), False, atoms);

    disp_info->connect = atoms[XA_WSM_NAME_CONNECT];
    disp_info->extensions = atoms[XA_WSM_NAME_EXTENSIONS];
    disp_info->config_fmt = atoms[XA_WSM_NAME_CONFIG_FMT];
    disp_info->get_state = atoms[XA_WSM_NAME_GET_STATE];
    disp_info->set_state = atoms[XA_WSM_NAME_SET_STATE];
    disp_info->reg_window = atoms[XA_WSM_NAME_REG_WINDOW];

    disp_info->get_background = atoms[XA_WSM_NAME_WM_GET_BACKGROUND_WINDOW];
    disp_info->set_background = atoms[XA_WSM_NAME_WM_SET_BACKGROUND_WINDOW];

    disp_info->wm_windows = atoms[XA_WSM_NAME_WM_WINDOWS];
    disp_info->wm_focus   = atoms[XA_WSM_NAME_WM_FOCUS];
    disp_info->wm_pointer = atoms[XA_WSM_NAME_WM_POINTER];

    /*
     * These global resources are unlikely to change.
     */

    disp_info->targets = atoms[XA_TARGETS];
    disp_info->multiple = atoms[XA_MULTIPLE];
    disp_info->timestamp = atoms[XA_TIMESTAMP];

    disp_info->screen_info = NULL;
    disp_info->next = NULL;

    return(disp_info);
}