Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!mips!smsc.sony.com!dce From: dce@smsc.sony.com (David Elliott) Newsgroups: comp.windows.x Subject: tvtwm patch to editres Message-ID: <1990Oct24.212046.14101@smsc.sony.com> Date: 24 Oct 90 21:20:46 GMT Sender: dce@smsc.sony.com (David Elliott) Organization: Sony Microsystems Corp, San Jose, CA Lines: 76 The following patch changes editres to work with tvtwm. On this subject, has anyone given any thought to how this code could be moved down into Xlib without any adverse effects on existing clients? *** /tmp/,RCSt1a00068 Wed Oct 24 14:18:28 1990 --- comm.c Wed Oct 24 14:17:52 1990 *************** *** 62,67 **** --- 62,109 ---- SetMessage(global_screen_data.info_label, msg); } + #ifdef SWM_VIRTUAL_ROOT + + /* Function Name: GetVRoot + * Description: Gets the root window, even if it's a virtual root + * Arguments: the display and the screen + * Returns: the root window for the client + */ + + Window + GetVRoot(dpy, scr) + Display *dpy; + Screen *scr; + { + + Window rootReturn, parentReturn, *children; + unsigned int numChildren; + Window root = RootWindowOfScreen(scr); + Atom __SWM_VROOT = None; + int i; + + __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); + XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren); + for (i = 0; i < numChildren; i++) + { + Atom actual_type; + int actual_format; + long nitems, bytesafter; + Window *newRoot = NULL; + + if (XGetWindowProperty (dpy, children[i], __SWM_VROOT,0,1, + False, XA_WINDOW, &actual_type, &actual_format, &nitems, + &bytesafter, (unsigned char **) &newRoot) == Success && newRoot) { + root = *newRoot; + break; + } + } + + return root; + } + + #endif /* SWM_VIRTUAL_ROOT */ + /* Function Name: GetClientWindow * Description: Gets the Client's window by asking the user. * Arguments: w - a widget. *************** *** 78,84 **** XEvent event; int buttons = 0; Display * dpy = XtDisplayOfObject(w); ! Window target_win = None, root = RootWindowOfScreen(XtScreenOfObject(w)); XtAppContext app = XtWidgetToApplicationContext(w); /* Make the target cursor */ --- 120,126 ---- XEvent event; int buttons = 0; Display * dpy = XtDisplayOfObject(w); ! Window target_win = None, root = GetVRoot(dpy, XtScreenOfObject(w)); XtAppContext app = XtWidgetToApplicationContext(w); /* Make the target cursor */