/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#endif
#include "awt_mgrsel.h"
/*
* Structures that describes the manager selection AWT listens to with
* callabacks to the subsytems interested in the selection. (We only
* listen to a couple of selections, so linear search is enough).
*/
struct AwtMgrsel {
void *cookie;
};
static int awt_mgrsel_screen(Window w);
#ifdef DEBUG
#endif
/*
* Find which screen the window W is the root of.
* Returns the screen number, or -1 if W is not a root.
*/
static int
{
int scr;
return (scr);
}
}
return (-1);
}
/************************************************************************
* For every one that asketh receiveth; and he that seeketh findeth;
* and to him that knocketh it shall be opened. (Luke 11:10).
*/
/*
* A method for a subsytem to express its interest in a certain
* manager selection.
*
* If owner changes, the callback_owner will be called with the screen
* number and the new owning window when onwership is established, or
* None if the owner is gone.
*
* Events in extra_mask are selected for on owning windows (exsiting
* ones and on new owners when established) and callback_event will be
* called with the screen number and an event.
*
* The function returns an array of current owners. The size of the
* array is ScreenCount(awt_display). The array is "owned" by this
* module and should be considered by the caller as read-only.
*/
const Window *
void *cookie,
void (*callback_event)(int, XEvent *, void *),
void (*callback_owner)(int, Window, long *, void *))
{
char *namesbuf;
char **names;
int per_scr_sz;
int scr;
/* buffer size for one per-screen atom name */
{
DTRACE_PRINTLN("MG: select: unable to allocate memory");
return (NULL);
}
}
if (status == 0) {
DTRACE_PRINTLN("MG: select: XInternAtoms failed");
return (NULL);
}
#ifdef DEBUG
} else {
}
#endif
}
return (per_scr_owners);
}
static Window
{
/* we'll get notified later if one arrives */
/* Workaround for bug 5039226 */
return (None);
}
/*
* Select for StructureNotifyMask to get DestroyNotify when owner
* is gone. Also select for any additional events caller is
* interested in (e.g. PropertyChangeMask). Caller will be
* notifed of these events via ... XXX ...
*/
/* Workaround for bug 5039226 */
return (owner);
}
/************************************************************************
* And so I saw the wicked buried, who had come and gone from the
* place of the holy, and they were forgotten in the city where they
* had so done: this is also vanity. (Eccl 8:10)
*/
#ifdef DEBUG
/*
* Print the message from the new manager that announces it acquired
* ownership.
*/
static void
{
int scr;
print_selname = "<None>";
} else {
print_selname = "<Unknown>";
}
}
DTRACE_PRINTLN4("MG: new MANAGER for %s: screen %d, owner 0x%08lx (@%lu)",
}
}
#endif /* DEBUG */
static int
{
int scr;
long timestamp;
long *data;
DTRACE_PRINTLN("MG: ClientMessage type != MANAGER, ignoring");
return (0);
}
#ifdef DEBUG
#endif
if (scr < 0) {
DTRACE_PRINTLN("MG: MANAGER ClientMessage with a non-root window!");
return (0);
}
/* is this a selection we are intrested in? */
break;
}
DTRACE_PRINTLN("MG: not interested in this selection, ignoring");
return (0);
}
/* notify the listener */
}
return (1);
}
static int
{
int scr;
/* is this a selection we are intrested in? */
/* can one window own selections for more than one screen? */
goto out; /* XXX??? */
}
}
}
out:
return (0);
}
DTRACE_PRINTLN3("MG: DestroyNotify for 0x%08lx, owner of %s at screen %d",
/* notify the listener (pass exowner as data???) */
}
return (1);
}
/*
* Hook to be called from toolkit event loop.
*/
int
{
int scr;
return (1);
}
return (1);
}
/* is this an event selected on one of selection owners? */
/* can one window own selections for more than one screen? */
goto out; /* XXX??? */
}
}
}
out:
DTRACE_PRINT2("MG: screen %d, event %d ... ",
DTRACE_PRINTLN("ignored");
return (0); /* not interested */
}
DTRACE_PRINTLN("dispatching");
}
#ifdef DEBUG
else {
DTRACE_PRINTLN("no callback");
}
#endif
return (1);
}
void
awt_mgrsel_init(void)
{
int scr;
if (inited) {
return;
}
/*
* Listen for ClientMessage's on each screen's root. We hook into
* the message loop in the toolkit (with awt_mgrsel_processEvent)
* to get the events processed. We need this for notifications of
* new manager acquiring ownership of the manager selection.
*/
}
}