Ejemplo n.º 1
0
static void
handle_top_level(Display * display, Window window,
		 Atom protocols_atom, Atom delete_window_atom)
{
	Atom       *prots;
	int         nprots, j;

	if (has_property(display, window, protocols_atom)) {
		XGetWMProtocols(display, window, &prots, &nprots);

		if (err_occurred)
			return;

		for (j = 0; j < nprots; j++)
			if (prots[j] == delete_window_atom) {
				send_delete_message(display, window,
					 protocols_atom, delete_window_atom);
				break;
			}
		if (j == nprots)	/* delete window not found */
			XKillClient(display, window);

		XFree((caddr_t) prots);
	} else
		XKillClient(display, window);
}
Ejemplo n.º 2
0
void DeleteRootAtoms(Display *dpy2, Window root2)
{
	Atom type;
	int format;
	unsigned long length, after;
	unsigned char *data;
	Bool e_deleted = False;

	XA_XSETROOT_ID = XInternAtom(dpy2, "_XSETROOT_ID", False);
	XA_ESETROOT_PMAP_ID = XInternAtom(dpy2, "ESETROOT_PMAP_ID", False);
	XA_XROOTPMAP_ID = XInternAtom(dpy2, "_XROOTPMAP_ID", False);

	if (XGetWindowProperty(
		    dpy2, root2, XA_XSETROOT_ID, 0L, 1L, True,
		    XA_PIXMAP, &type, &format, &length, &after, &data) ==
	    Success && type == XA_PIXMAP && format == 32 && length == 1 &&
	    after == 0 && (Pixmap)(*(long *)data) != None)
	{
		XKillClient(dpy2, *((Pixmap *)data));
	}
	if (XGetWindowProperty(
		    dpy2, root2, XA_ESETROOT_PMAP_ID, 0L, 1L, True,
		    XA_PIXMAP, &type, &format, &length, &after, &data) ==
	    Success && type == XA_PIXMAP && format == 32 && length == 1 &&
	    after == 0 && (Pixmap)(*(Pixmap *)data) != None)
	{
		e_deleted = True;
		XKillClient(dpy2, *((Pixmap *)data));
	}
	if (e_deleted)
	{
		XDeleteProperty(dpy2, root2, XA_XROOTPMAP_ID);
	}
}
Ejemplo n.º 3
0
static void
kill_tree(Display * display, Window window)
{
	Window      root, parent, *kids;
	unsigned int nkids;
	int         j;

	for (;;) {
		XQueryTree(display, window, &root, &parent, &kids, &nkids);
		if (err_occurred) {
			err_occurred = False;
			return;
		}
		for (j = 0; j < nkids; j++) {
			XKillClient(display, kids[j]);
			if (err_occurred)
				break;
		}

		XFree((caddr_t) kids);

		/* when I get all the way through a level without an error, I'm done  */

		if (err_occurred)
			err_occurred = False;
		else
			return;
	}
}
Ejemplo n.º 4
0
void
meta_window_delete (MetaWindow  *window,
                    guint32      timestamp)
{
  meta_error_trap_push (window->display);
  if (window->delete_window)
    {
      meta_topic (META_DEBUG_WINDOW_OPS,
                  "Deleting %s with delete_window request\n",
                  window->desc);
      meta_window_send_icccm_message (window,
                                      window->display->atom_WM_DELETE_WINDOW,
                                      timestamp);
    }
  else
    {
      meta_topic (META_DEBUG_WINDOW_OPS,
                  "Deleting %s with explicit kill\n",
                  window->desc);
      XKillClient (window->display->xdisplay, window->xwindow);
    }
  meta_error_trap_pop (window->display);

  meta_display_ping_window (window->display,
                            window,
                            timestamp,
                            delete_ping_reply_func,
                            delete_ping_timeout_func,
                            window);
}
Ejemplo n.º 5
0
void DestroySwallow(struct XObj *xobj)
{
	/* Arrete le programme swallow */
	if (xobj->win!=None)
		XKillClient(dpy, xobj->win);
	xobj->win = None;
}
Ejemplo n.º 6
0
int X_syspopup_process_keydown(int id, const char *keyname)
{
	Display *d;
	Window win;
	syspopup *sp = NULL;

	if (strcmp(keyname, KEY_END) == 0) {
		d = XOpenDisplay(NULL);
		sp = _syspopup_find_by_id(id);
		if (sp != NULL) {
			_D("find key down - %s", sp->name);
			if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) {
				if (sp->def_term_fn != NULL)
					sp->def_term_fn(sp->dupped_bundle,
							sp->user_data);
				win = (Window) sp->internal_data;
				XKillClient(d, win);

			} else if (sp->endkey_act == SYSPOPUP_KEYEND_HIDE) {
				if (sp->def_term_fn != NULL)
					sp->def_term_fn(sp->dupped_bundle,
							sp->user_data);
				win = (Window) sp->internal_data;
				XUnmapWindow(d, win);
			}

		} else {
			_E("no find key down");
		}

		XCloseDisplay(d);
	}

	return 0;
}
Ejemplo n.º 7
0
void App::KillAllClients(Bool top) {
    Window dummywindow;
    Window *children;
    unsigned int nchildren;
    unsigned int i;
    XWindowAttributes attr;

    XSync(Dpy, 0);
    XSetErrorHandler(CatchErrors);

    nchildren = 0;
    XQueryTree(Dpy, Root, &dummywindow, &dummywindow, &children, &nchildren);
    if(!top) {
        for(i=0; i<nchildren; i++) {
            if(XGetWindowAttributes(Dpy, children[i], &attr) && (attr.map_state == IsViewable))
                children[i] = XmuClientWindow(Dpy, children[i]);
            else
                children[i] = 0;
        }
    }

    for(i=0; i<nchildren; i++) {
        if(children[i])
            XKillClient(Dpy, children[i]);
    }
    XFree((char *)children);

    XSync(Dpy, 0);
    XSetErrorHandler(NULL);
}
Ejemplo n.º 8
0
void
meta_window_kill (MetaWindow *window)
{
  meta_topic (META_DEBUG_WINDOW_OPS,
              "Killing %s brutally\n",
              window->desc);

  if (!meta_window_is_remote (window) &&
      window->net_wm_pid > 0)
    {
      meta_topic (META_DEBUG_WINDOW_OPS,
                  "Killing %s with kill()\n",
                  window->desc);

      if (kill (window->net_wm_pid, 9) < 0)
        meta_topic (META_DEBUG_WINDOW_OPS,
                    "Failed to signal %s: %s\n",
                    window->desc, strerror (errno));
    }

  meta_topic (META_DEBUG_WINDOW_OPS,
              "Disconnecting %s with XKillClient()\n",
              window->desc);
  meta_error_trap_push (window->display);
  XKillClient (window->display->xdisplay, window->xwindow);
  meta_error_trap_pop (window->display);
}
void
kill_launched_win(Window win)
{
  int i, n, found = 0;
  Atom *protocols;
  XEvent e;
			  
  if (XGetWMProtocols(dpy, win,
		      &protocols, &n))
    {
      for (i=0; i<n; i++)
	if (protocols[i] == atom_wm_delete) found++;
      XFree(protocols);
    }
			  
  if (found)
    {
      e.type = ClientMessage;
      e.xclient.window = win;
      e.xclient.message_type = atom_wm_protos;
      e.xclient.format = 32;
      e.xclient.data.l[0] = atom_wm_delete;
      e.xclient.data.l[1] = CurrentTime;
      XSendEvent(dpy, win, False, NoEventMask, &e);
    }
  else
    {
      XKillClient(dpy, win);
    }
}
Ejemplo n.º 10
0
static int 
kill_all_windows(Display *dpy, int screenno, Bool top)
{
    Window root = RootWindow (dpy, screenno);
    Window dummywindow;
    Window *children;
    unsigned int nchildren;
    unsigned int i;
    XWindowAttributes attr;

    XSync (dpy, 0);
    XSetErrorHandler (catch_window_errors);

    nchildren = 0;
    XQueryTree (dpy, root, &dummywindow, &dummywindow, &children, &nchildren);
    if (!top) {
	for (i = 0; i < nchildren; i++) {
	    if (XGetWindowAttributes(dpy, children[i], &attr) &&
		(attr.map_state == IsViewable))
		children[i] = XmuClientWindow(dpy, children[i]);
	    else
		children[i] = 0;
	}
    }
    for (i = 0; i < nchildren; i++) {
	if (children[i])
	    XKillClient (dpy, children[i]);
    }
    XFree ((char *)children);

    XSync (dpy, 0);
    XSetErrorHandler (NULL);		/* pretty stupid way to do things... */

    return 0;
}
Ejemplo n.º 11
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);
}
Ejemplo n.º 12
0
static void
init_mit_saver_extension (saver_info *si)
{
  int i;
  Pixmap *blank_pix = (Pixmap *) calloc (sizeof(Pixmap), si->nscreens);

  for (i = 0; i < si->nscreens; i++)
    {
      saver_screen_info *ssi = &si->screens[i];
      XID kill_id = 0;
      Atom kill_type = 0;
      Window root = RootWindowOfScreen (ssi->screen);
      blank_pix[i] = XCreatePixmap (si->dpy, root, 1, 1, 1);

      /* Kill off the old MIT-SCREEN-SAVER client if there is one.
	 This tends to generate X errors, though (possibly due to a bug
	 in the server extension itself?) so just ignore errors here. */
      if (XScreenSaverGetRegistered (si->dpy,
				     XScreenNumberOfScreen (ssi->screen),
				     &kill_id, &kill_type)
	  && kill_id != blank_pix[i])
	{
	  XErrorHandler old_handler =
	    XSetErrorHandler (ignore_all_errors_ehandler);
	  XKillClient (si->dpy, kill_id);
	  XSync (si->dpy, False);
	  XSetErrorHandler (old_handler);
	}
      XScreenSaverSelectInput (si->dpy, root, ScreenSaverNotifyMask);
      XScreenSaverRegister (si->dpy,
			    XScreenNumberOfScreen (ssi->screen),
			    (XID) blank_pix[i], XA_PIXMAP);
    }
  free(blank_pix);
}
Ejemplo n.º 13
0
static void
kill_window (WnckWindow *win)
{
    WnckApplication *app;

    app = wnck_window_get_application (win);
    if (app)
    {
	gchar buf[257], *client_machine;
	int   pid;

	pid = wnck_application_get_pid (app);
	client_machine = get_client_machine (wnck_application_get_xid (app));

	if (client_machine && pid > 0)
	{
	    if (gethostname (buf, sizeof (buf) - 1) == 0)
	    {
		if (strcmp (buf, client_machine) == 0)
		    kill (pid, 9);
	    }
	}

	if (client_machine)
	    g_free (client_machine);
    }

    gdk_error_trap_push ();
    XKillClient (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wnck_window_get_xid (win));
    gdk_display_sync (gdk_display_get_default ());
    gdk_error_trap_pop_ignored ();
}
Ejemplo n.º 14
0
//=========================================
// kill all clients...
//-----------------------------------------
void closeClients (Display *dpy) {
	Window root = DefaultRootWindow (dpy);
	Window dummywindow;
	Window *children;
	XWindowAttributes attr;
	unsigned int nchildren;
	unsigned int i;

	XSync (dpy, 0);
	XSetErrorHandler (catchWindowErrors);

	nchildren = 0;
	XQueryTree (
		dpy, root, &dummywindow, &dummywindow, 
		&children, &nchildren
	);
	for (i = 0; i < nchildren; i++) {
	if ( XGetWindowAttributes (dpy, children[i], &attr) && 
		(attr.map_state == IsViewable)
	) {
		children[i] = XmuClientWindow(dpy, children[i]);
	} else {
		children[i] = 0;
	}
	}
	for (i = 0; i < nchildren; i++) {
	if (children[i])
		XKillClient (dpy, children[i]);
	}
	XFree ((char *)children);
	XSync (dpy, 0);
	XSetErrorHandler (NULL);        
}
Ejemplo n.º 15
0
void xconn_clean(xconn_t c)
{
	Window dummy, parent;
	Window *children;
	unsigned int nchildren;
	unsigned int i;
	Window Root;

	if(!c) return;

	XSetErrorHandler(CatchErrors);
	XSetIOErrorHandler(CatchIOErrors);

	Root = DefaultRootWindow(c);

	nchildren = 0;
	if(!setjmp(XErrEnv))
		XQueryTree(c, Root, &dummy, &parent, &children, &nchildren);
	else
		goto out;
	for( i = 0; i < nchildren; i++ )
	{
		if(!setjmp(XErrEnv))
		XKillClient(c, children[i]);
	}
	XFree((char *)children);
	if(!setjmp(XErrEnv))
		XSync(c, 0);
out:
	XSetErrorHandler(NULL);
	XSetIOErrorHandler(NULL);
}
Ejemplo n.º 16
0
Archivo: DelCmap.c Proyecto: aosm/X11
void
XmuDeleteStandardColormap(Display *dpy, int screen, Atom property)
     /* dpy;		- specifies the X server to connect to
      * screen		- specifies the screen of the display
      * property	- specifies the standard colormap property
      */
{
    XStandardColormap	*stdcmaps, *s;
    int			count = 0;

    if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
			 property))
    {
	for (s=stdcmaps; count > 0; count--, s++) {
	    if ((s->killid == ReleaseByFreeingColormap) &&
		(s->colormap != None) &&
		(s->colormap != DefaultColormap(dpy, screen)))
		XFreeColormap(dpy, s->colormap);
	    else if (s->killid != None)
		XKillClient(dpy, s->killid);
	}
	XDeleteProperty(dpy, RootWindow(dpy, screen), property);
	XFree((char *) stdcmaps);
	XSync(dpy, False);
    }
}
Ejemplo n.º 17
0
static gboolean __X_syspopup_timeout_handler(void *user_data)
{
	syspopup *sp = NULL;
	Display *d;
	int id;
	Window win;

	id = (int)user_data;

	d = XOpenDisplay(NULL);

	sp = _syspopup_find_by_id(id);
	if (sp != NULL) {
		_D("find timeout - %s", sp->name);
		if (sp->def_timeout_fn != NULL)
			sp->def_timeout_fn(sp->dupped_bundle, sp->user_data);
		win = (Window) sp->internal_data;
		XKillClient(d, win);
	} else {
		_E("no find timeout");
	}

	XCloseDisplay(d);

	return 0;
}
Ejemplo n.º 18
0
void DockContainer::kill()
{
    if ( _embeddedWinId ) {
        XKillClient( qt_xdisplay(), _embeddedWinId );
        _embeddedWinId = 0; // in case the window does not exist anymore..
    }
    else emit embeddedWindowDestroyed(this); /* enable killing of empty windows.. */
}
Ejemplo n.º 19
0
void Client::kill()
{
    if (m_protocol & Pdelete) {
	sendMessage(Atoms::wm_protocols, Atoms::wm_delete);
    } else {
	XKillClient(display(), m_window);
    }
}
Ejemplo n.º 20
0
void
meta_window_delete (MetaWindow  *window,
                    guint32      timestamp)
{
  meta_error_trap_push (window->display);
  if (window->delete_window)
    {
      meta_topic (META_DEBUG_WINDOW_OPS,
                  "Deleting %s with delete_window request\n",
                  window->desc);
      meta_window_send_icccm_message (window,
                                      window->display->atom_WM_DELETE_WINDOW,
                                      timestamp);
    }
  else
    {
      meta_topic (META_DEBUG_WINDOW_OPS,
                  "Deleting %s with explicit kill\n",
                  window->desc);
      XKillClient (window->display->xdisplay, window->xwindow);
    }
  meta_error_trap_pop (window->display, FALSE);

  meta_display_ping_window (window->display,
                            window,
                            timestamp,
                            delete_ping_reply_func,
                            delete_ping_timeout_func,
                            window);
  
  if (window->has_focus)
    {
      /* FIXME Clean this up someday 
       * http://bugzilla.gnome.org/show_bug.cgi?id=108706
       */
#if 0
      /* This is unfortunately going to result in weirdness
       * if the window doesn't respond to the delete event.
       * I don't know how to avoid that though.
       */
      meta_topic (META_DEBUG_FOCUS,
                  "Focusing default window because focus window %s was deleted/killed\n",
                  window->desc);
      meta_workspace_focus_default_window (window->screen->active_workspace,
                                           window);
#else
      meta_topic (META_DEBUG_FOCUS,
                  "Not unfocusing %s on delete/kill\n",
                  window->desc);
#endif
    }
  else
    {
      meta_topic (META_DEBUG_FOCUS,
                  "Window %s was deleted/killed but didn't have focus\n",
                  window->desc);
    }
}
Ejemplo n.º 21
0
void
killclient(Arg *arg) {
    if(!sel)
        return;
    if(isprotodel(sel))
        sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
    else
        XKillClient(dpy, sel->win);
}
Ejemplo n.º 22
0
void StopWinMenu(short selected, XEvent *event)
{
  switch(selected){
    case I_ICONIFY:
      IconifyWin(TheWin);
      break;
    case I_CLOSE:
      CloseWin(TheWin);
      break;
    case I_AUTORISE:
      if(TheWin->flags & RISEN) {
        MoveResizeWin(TheWin, TheWin->ra.x, TheWin->ra.y,
                      TheWin->ra.w, TheWin->ra.h);
        TheWin->flags &= ~RISEN;
      } else {
        int maxw, maxh, bw, bh, wi, hi;
        maxw = TheWin->ra.maxw;
        maxh = TheWin->ra.maxh;
        bw = TheWin->ra.bw;
        bh = TheWin->ra.bh;
        wi = TheWin->ra.wi;
        hi = TheWin->ra.hi;
        TheWin->ra.x = TheWin->Attr.x;
        TheWin->ra.y = TheWin->Attr.y;
        TheWin->ra.w = TheWin->Attr.width;
        TheWin->ra.h = TheWin->Attr.height;
        MoveResizeWin(TheWin, 0, 0,
                      (maxw > TheScreen.width)
                      ? (bw + ((int)((TheScreen.width - bw - 1) / wi)) * wi)
                      : maxw,
                      (maxh > TheScreen.height)
                      ? (bh + ((int)((TheScreen.height - bh - 1) / hi)) * hi)
                      : maxh);

        TheWin->flags |= RISEN;
      }
      break;
    case I_BACK:
      LowerWin(TheWin);
      break;
    case I_KILL:
      break;
    case I_MENU:
      WinMenuMenu(TheWin, event->xbutton.x, event->xbutton.y);
      break;
    case I_REALLY:
      XKillClient(disp, TheWin->win);
      break;
    default:
      if(move_back) XWarpPointer(disp, None, None, 0, 0, 0, 0, hexX, hexY);
  }
  XUnmapWindow(disp, TheScreen.HexMenu.IconParent);
  if(TheWin) XInstallColormap(disp, TheWin->Attributes.colormap);
  ReinstallDefaultHandle();

  UngrabPointer();
}
Ejemplo n.º 23
0
NPError 
NPP_Destroy(NPP instance, NPSavedData** save)
{
  SqueakPlugin *plugin;
  DPRINT("NP: NPP_Destroy\n");
  if (!instance)
    return NPERR_INVALID_INSTANCE_ERROR;
  plugin= (SqueakPlugin*) instance->pdata;
  if (plugin) {
    int i;
    if (plugin->sqwindow && plugin->display) {
      DPRINT("NP: DestroyWindow %x\n", 
	     plugin->sqwindow);
      XSetErrorHandler(IgnoreErrors);
      XSync(plugin->display,0);
      XKillClient(plugin->display, plugin->sqwindow);
      XSync(plugin->display,0);
    }
    if (plugin->pid) {
      DPRINT("NP: kill 0x%i\n", plugin->pid);
      kill(plugin->pid, SIGTERM);
      plugin->pid= 0;
    }
    if (plugin->input) {
      XtRemoveInput(plugin->input);
    }
    for (i= 0; i < 4; i++)
      if (plugin->pipes[i]) {
	close(plugin->pipes[i]);
	plugin->pipes[i]= 0;
      }
    if (plugin->srcUrl) {
      NPN_MemFree(plugin->srcUrl);
      plugin->srcUrl= NULL;
    }
    if (plugin->srcFilename) {
      NPN_MemFree(plugin->srcFilename);
      plugin->srcFilename= NULL;
    }
    if (plugin->failureUrl) {
      NPN_MemFree(plugin->failureUrl);
      plugin->failureUrl= NULL;
    }
    if (plugin->argv) {
      for (i= 0; i < plugin->argc; i++) {
	if (plugin->argv[i])
	  NPN_MemFree(plugin->argv[i]);
      }
      plugin->argc= 0;
      NPN_MemFree(plugin->argv);
      plugin->argv= NULL;
    }
    NPN_MemFree(plugin);
  }
  instance->pdata= NULL;
  return NPERR_NO_ERROR;
}
Ejemplo n.º 24
0
void x_shutdown(void) {
	Window dummy, *wins;
	Window root = RootWindow(fl_display, fl_screen);
	unsigned int n;

	if(!XQueryTree(fl_display, root, &dummy, &dummy, &wins, &n))
		return;

	Atom wm_protocols     = XInternAtom(fl_display, "WM_PROTOCOLS", False);
	Atom wm_delete_window = XInternAtom(fl_display, "WM_DELETE_WINDOW", False);
	Atom wm_state         = XInternAtom(fl_display, "WM_STATE", False);
	XWindowAttributes attr;
	XEvent ev;

	for(unsigned int i = 0; i < n; i++) {
		if(XGetWindowAttributes(fl_display, wins[i], &attr) && (attr.map_state == IsViewable))
			wins[i] = mu_client_window(fl_display, wins[i], wm_state);
		else
			wins[i] = 0;
	}

	/*
	 * Hm... probably we should first quit known processes started by us
	 * then rest of the X familly
	 */
	for(unsigned int i = 0; i < n; i++) {
		if(wins[i]) {
			/* FIXME: check WM_PROTOCOLS before sending WM_DELETE_WINDOW ??? */
			memset(&ev, 0, sizeof(ev));
			ev.xclient.type = ClientMessage;
			ev.xclient.window = wins[i];
			ev.xclient.message_type = wm_protocols;
			ev.xclient.format = 32;
			ev.xclient.data.l[0] = (long)wm_delete_window;
			ev.xclient.data.l[1] = CurrentTime;
			XSendEvent(fl_display, wins[i], False, 0L, &ev);
		}
	}

	XSync(fl_display, False);
	sleep(1);

	/* kill remaining windows */
	for(unsigned int i = 0; i < n; i++) {
		if(wins[i]) { 
			XKillClient(fl_display, wins[i]);
		}
	}

	XSync(fl_display, False);
	XFree(wins);
}
Ejemplo n.º 25
0
void send_wm_delete(Client *c, int kill_client) {
	int i, n, found = 0;
	Atom *protocols;

	if (!kill_client && XGetWMProtocols(dpy, c->window, &protocols, &n)) {
		for (i = 0; i < n; i++)
			if (protocols[i] == xa_wm_delete)
				found++;
		XFree(protocols);
	}
	if (found)
		send_xmessage(c->window, xa_wm_protos, xa_wm_delete);
	else
		XKillClient(dpy, c->window);
}
Ejemplo n.º 26
0
////////// DESTROY WINDOW //////////////
void Frame::destroy_it()
{
    if (prot_delete)
    {
        qDebug() << "--> Send wm_delete_window";
        Atom wm_delete_window = XInternAtom(QX11Info::display(), "WM_DELETE_WINDOW", FALSE);
        send_wm_protocols(wm_delete_window, CurrentTime);
    }
    else
    {
        qDebug() << "--> Call XKillClient";
        XKillClient(QX11Info::display(), c_win);
        XSync(QX11Info::display(), FALSE);
    }
}
Ejemplo n.º 27
0
// Adapted from fluxbox' bsetroot
int setRootAtoms (Pixmap pixmap)
{
	Atom atom_root, atom_eroot, type;
	unsigned char *data_root, *data_eroot;
	int format;
	unsigned long length, after;

	atom_root = XInternAtom (display, "_XROOTMAP_ID", True);
	atom_eroot = XInternAtom (display, "ESETROOT_PMAP_ID", True);

	// doing this to clean up after old background
	if (atom_root != None && atom_eroot != None)
	{
		XGetWindowProperty (display, RootWindow (display, screen),
							atom_root, 0L, 1L, False, AnyPropertyType,
							&type, &format, &length, &after, &data_root);

	if (type == XA_PIXMAP)
	{
		XGetWindowProperty (display, RootWindow (display, screen),
							atom_eroot, 0L, 1L, False, AnyPropertyType,
							&type, &format, &length, &after, &data_eroot);

	if (data_root && data_eroot && type == XA_PIXMAP &&
		*((Pixmap *) data_root) == *((Pixmap *) data_eroot))
	{
		XKillClient (display, *((Pixmap *) data_root));
	}
  } // second if
} //first if

	atom_root = XInternAtom (display, "_XROOTPMAP_ID", False);
	atom_eroot = XInternAtom (display, "ESETROOT_PMAP_ID", False);

	if (atom_root == None || atom_eroot == None)
		return 0;

	// setting new background atoms
	XChangeProperty (display, RootWindow (display, screen),
					atom_root, XA_PIXMAP, 32, PropModeReplace,
					(unsigned char *) &pixmap, 1);

	XChangeProperty (display, RootWindow (display, screen), atom_eroot,
					XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap,
					1);

	return 1;
}
static void
kill_window_response (GtkDialog *dialog,
		      gint       response_id,
		      gpointer   user_data)
{
	if (response_id == GTK_RESPONSE_ACCEPT) {
		Window window = (Window) user_data;

		gdk_error_trap_push ();
		XKillClient (gdk_display, window);
		gdk_flush ();
		gdk_error_trap_pop ();
	}

	gtk_widget_destroy (GTK_WIDGET (dialog));
}
Ejemplo n.º 29
0
static void
killWindows (Display *dpy, Window window)
{
	Window	root, parent, *children;
	int	child;
	unsigned int nchildren = 0;

	while (XQueryTree (dpy, window, &root, &parent, &children, &nchildren)
	       && nchildren > 0)
	{
		for (child = 0; child < nchildren; child++) {
			Debug ("XKillClient 0x%lx\n", (unsigned long)children[child]);
			XKillClient (dpy, children[child]);
		}
		XFree ((char *)children);
	}
}
Ejemplo n.º 30
0
void TModuleView::killRootProcess()
{
  if (_embedWidget &&  _embedWidget->embeddedWinId())
    XKillClient(qt_xdisplay(), _embedWidget->embeddedWinId());

  delete _embedWidget;
  _embedWidget = 0;

  delete _embedStack;
  _embedStack = 0;

  delete _proc;
  _proc = 0;

  delete _embedLayout;
  _embedLayout = 0;

}