Hi all, This is so far I can get. The global menu window is created in js/ui/panel.js with this patch. (1) Is it plausible to put the widget into the top panel as done in shell-tray-manager? If so perhaps some more general code that is ready to be called by js will be better. (2) If I set the user_data of root window to a widget, gnome shell won't be able to obtain any events from it. I guess the reason is that Gtk will consume all GdkEvents before gnome shell gets the prop-changed notifications. Is there a way to work around this problem? Regards, Yu
Index: js/ui/panel.js
===================================================================
--- js/ui/panel.js (revision 164)
+++ js/ui/panel.js (working copy)
@@ -5,9 +5,13 @@
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Tidy = imports.gi.Tidy;
+const Wnck = imports.gi.Wnck;
+const Gdk = imports.gi.Gdk;
const Button = imports.ui.button;
const Main = imports.ui.main;
+const Gtk = imports.gi.Gtk;
+const Gnomenu = imports.gi.Gnomenu;
const PANEL_HEIGHT = 32;
const TRAY_HEIGHT = 24;
@@ -26,6 +30,7 @@
this._group = new Clutter.Group();
+
let background = new Clutter.Rectangle({ color: PANEL_BACKGROUND_COLOR,
reactive: true,
width: global.screen_width+2,
@@ -72,6 +77,23 @@
});
this._traymanager.manage_stage(global.stage);
+ this._window = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
+// this._window.set_type_hint (Gdk.WindowTypeHint.DOCK);
+ this._window.set_accept_focus (false);
+ this._globalmenu = new Gnomenu.GlobalMenu();
+ this._globalmenu.visible = true;
+ this._window.add(this._globalmenu);
+ this._window.visible = true;
+
+ this._gmmonitor = new Gnomenu.Monitor();
+ this._gmmonitor.connect("window-changed",
+ function (o, prev) {
+ var xid = me._gmmonitor.current_xid;
+ log("window changed = " + xid);
+ me._globalmenu.switch_to(xid);
+ });
+ this._gmmonitor.screen = this._window.get_screen();
+
// TODO: decide what to do with the rest of the panel in the overlay mode (make it fade-out, become non-reactive, etc.)
// We get into the overlay mode on button-press-event as opposed to button-release-event because eventually we'll probably
// have the overlay act like a menu that allows the user to release the mouse on the activity the user wants
Index: js/ui/overlay.js
===================================================================
--- js/ui/overlay.js (revision 164)
+++ js/ui/overlay.js (working copy)
@@ -59,8 +59,8 @@
let searchIconTexture = new Clutter.Texture({ x: SIDESHOW_PAD + 2,
y: rect.y + 2 });
- let searchIconPath = icontheme.lookup_icon('gtk-find', 16, 0).get_filename();
- searchIconTexture.set_from_file(searchIconPath);
+ //let searchIconPath = icontheme.lookup_icon('gtk-find', 16, 0).get_filename();
+ //searchIconTexture.set_from_file(searchIconPath);
this.actor.add_actor(searchIconTexture);
// We need to initialize the text for the entry to have the cursor displayed
Attachment:
Screenshot-Untitled Window.jpeg
Description: JPEG image