I posted about this over on the GtkD site, but I suspect no one's
home until later in the day.
I've been writing up examples for menus and found some odd
behaviour. Now I'm wondering if I've missed something.
The code compiles without error and runs.
But after the window opens, first click on the menu results in a
blue line appearing under the menu title. Second click and the
menu finally drops.
This is the code boiled down to the bare minimum. It a single
menu with a single item which is a submenu and it, in turn, has a
single item.
The original was more elaborate with multiple menus and multiple
items, only one of which was a submenu. I've tried a number of
variations, but it seems that submenus always cause this
behaviour.
I've also tried various OOP versions of this code. Same result.
Any ideas about why this is happening? Bug? Bad code? Programmer
not holding mouth in correct position?
import std.stdio;
import gtk.MainWindow;
import gtk.Box;
import gtk.Main;
import gtk.Menu;
import gtk.MenuBar;
import gtk.MenuItem;
import gtk.Widget;
import gdk.Event;
void main(string[] args)
{
Main.init(args);
MainWindow testRig = new MainWindow("Title");
Box appBox = new Box(Orientation.VERTICAL, 5);
testRig.add(appBox);
MenuBar menuBar = new MenuBar();
appBox.packStart(menuBar, false, false, 0);
MenuItem header = new MenuItem("File");
menuBar.append(header);
Menu fileMenu = new Menu();
header.setSubmenu(fileMenu);
MenuItem newFileItem = new MenuItem("New");
fileMenu.append(newFileItem);
Menu newFileSubmenu = new Menu();
newFileItem.setSubmenu(newFileSubmenu);
MenuItem dNewFileItem = new MenuItem("D File");
newFileSubmenu.append(dNewFileItem);
testRig.showAll();
Main.run();
} // main()
And it still does the same thing. First click, blue line. Second
click, menu drops.

It could be so, I'm not using gnome so I can't say.
By the way, I'm using gtk3 3.24.5.

Yeah, I updated from 3.22 to 3.24, but it made no difference on
Windows 10. Still that delay with submenus.
I'd rather be running FreeBSD, but ATM I'm using an MSI laptop
with two external monitors and I'm still working on getting Xorg
configured to recognize even one of those external monitors. So,
until then, I guess I'm stuck with this behaviour.

It could be so, I'm not using gnome so I can't say.
By the way, I'm using gtk3 3.24.5.

Yeah, I updated from 3.22 to 3.24, but it made no difference on
Windows 10. Still that delay with submenus.
I'd rather be running FreeBSD, but ATM I'm using an MSI laptop
with two external monitors and I'm still working on getting
Xorg configured to recognize even one of those external
monitors. So, until then, I guess I'm stuck with this behaviour.

Hi Ron,
xrandr (and gui interfaces for it like arandr) are your friends
here.
xrandr -q -> shows your card outputs and then you can use xrandr
+ options to configure monitors.
Or you can use arandr that will do that for you and will allow
you to visually spatially-arrange your monitors.
Antonio

Hi Ron,
xrandr (and gui interfaces for it like arandr) are your friends
here.
xrandr -q -> shows your card outputs and then you can use
xrandr + options to configure monitors.
Or you can use arandr that will do that for you and will allow
you to visually spatially-arrange your monitors.
Antonio

Thanks for the tip, Antonio. I'd never heard of xrandr or arandr.
Must be new since I stopped paying attention a few years ago.

Hi Ron,
xrandr (and gui interfaces for it like arandr) are your
friends here.
xrandr -q -> shows your card outputs and then you can use
xrandr + options to configure monitors.
Or you can use arandr that will do that for you and will allow
you to visually spatially-arrange your monitors.
Antonio

Thanks for the tip, Antonio. I'd never heard of xrandr or
arandr. Must be new since I stopped paying attention a few
years ago.

No, xrandr has been around for a long time:
https://www.x.org/wiki/Projects/XRandR/
It makes easier than xinerama to configure several monitors. For
example when I start my xsession with an external monitor
attached to the HDMI port, I switch-off the internal laptop panel
and use only the external one, a small script like this does the
trick:
xrandr | grep "HDMI-1 conn" >/dev/null
if [ $? = 0 ]
then
xrandr --output HDMI-1 --auto --primary --output LVDS-1 --off
fi
Those names like HDMI-1 or LVDS-1 are the ones that 'xrandr' or
'xrandr -q' show you. Depending on the driver/card combination
they may change.
Xrandr requires that your card driver supports it, nowadays it is
the usual thing, but you'll have to check that.
Arandr (there are others) simplify the configure task due to
their GUI based interface, though I prefer the text based
interface that xrandr offers.
Antonio.