1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
100
101 void dispose() {
102 selection.removeSelectionListener(this);
103 }
104
105 // ***********************************************************************
106 // ***********************************************************************
107
108 void addTrayIcon(XTrayIconPeer tiPeer) throws AWTException {
109 long selection_owner = selection.getOwner(SCREEN);
110
111 if (log.isLoggable(PlatformLogger.Level.FINE)) {
112 log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner);
113 }
114
115 if (selection_owner == XConstants.None) {
116 throw new AWTException("TrayIcon couldn't be displayed.");
117 }
118
119 long tray_window = tiPeer.getWindow();
120 long data[] = new long[] {XEmbedHelper.XEMBED_VERSION, XEmbedHelper.XEMBED_MAPPED};
121 long data_ptr = Native.card32ToData(data);
122
123 _XEMBED_INFO.setAtomData(tray_window, data_ptr, data.length);
124
125 sendMessage(selection_owner, SYSTEM_TRAY_REQUEST_DOCK, tray_window, 0, 0);
126 }
127
128 void sendMessage(long win, long msg, long data1, long data2, long data3) {
129 XClientMessageEvent xev = new XClientMessageEvent();
130
131 try {
132 xev.set_type(XConstants.ClientMessage);
133 xev.set_window(win);
134 xev.set_format(32);
135 xev.set_message_type(_NET_SYSTEM_TRAY_OPCODE.getAtom());
136 xev.set_data(0, 0);
137 xev.set_data(1, msg);
138 xev.set_data(2, data1);
139 xev.set_data(3, data2);
140 xev.set_data(4, data3);
|
1 /*
2 * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
100
101 void dispose() {
102 selection.removeSelectionListener(this);
103 }
104
105 // ***********************************************************************
106 // ***********************************************************************
107
108 void addTrayIcon(XTrayIconPeer tiPeer) throws AWTException {
109 long selection_owner = selection.getOwner(SCREEN);
110
111 if (log.isLoggable(PlatformLogger.Level.FINE)) {
112 log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner);
113 }
114
115 if (selection_owner == XConstants.None) {
116 throw new AWTException("TrayIcon couldn't be displayed.");
117 }
118
119 long tray_window = tiPeer.getWindow();
120 long[] data = new long[] {XEmbedHelper.XEMBED_VERSION, XEmbedHelper.XEMBED_MAPPED};
121 long data_ptr = Native.card32ToData(data);
122
123 _XEMBED_INFO.setAtomData(tray_window, data_ptr, data.length);
124
125 sendMessage(selection_owner, SYSTEM_TRAY_REQUEST_DOCK, tray_window, 0, 0);
126 }
127
128 void sendMessage(long win, long msg, long data1, long data2, long data3) {
129 XClientMessageEvent xev = new XClientMessageEvent();
130
131 try {
132 xev.set_type(XConstants.ClientMessage);
133 xev.set_window(win);
134 xev.set_format(32);
135 xev.set_message_type(_NET_SYSTEM_TRAY_OPCODE.getAtom());
136 xev.set_data(0, 0);
137 xev.set_data(1, msg);
138 xev.set_data(2, data1);
139 xev.set_data(3, data2);
140 xev.set_data(4, data3);
|