[fltk.general] Fl_Sys_Menu_Bar shortcut bug on MacOS

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
Previous Message ]New Message | Reply ]Next Message ]

Fl_Sys_Menu_Bar shortcut bug on MacOS rs 00:28 Oct 09 top right image
Hi All,

I think I've discovered a bug in Fl_Sys_Menu_Bar for MacOS.

Basically if I assign a menu item a shortcut FL_ALT+'u', the use of that shortcut appears to "block" other shortcuts in the menu bar.

I proved minimal working code demonstrating the bug below. In this case command+f or command+g work as expected until I use the shortcut alt+u after which the previous two commands stop working.

This, however *doesn't* affect an identically defined shortcut FL_COMMAND+'i' so it appears to be contingent on the precise shortcut.

If I then navigate to the menu bar with the mouse the shortcuts "reactivate" and respond  normally again.

Other key points:

1. If I replace alt+'u' with alt+'t' this bug doesn't manifest
2. This only happens with Fl_Sys_Menu_Bar on Mac. Using Fl_Menu_Bar on mac does not exhibit this bug.

This has been tested on MacOS 11.6 using both FLTK 1.3.7 and 1.4.x


#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Sys_Menu_Bar.H>
#include <stdio.h>
#include <iostream>

void ctrlf(Fl_Widget *, void *) {
  std::cout<<"in cmd f"<<std::endl;

void ctrlg(Fl_Widget *, void *) {
  std::cout<<"in cmd g"<<std::endl;

void ctrli(Fl_Widget *, void *) {
  std::cout<<"in cmd i"<<std::endl;

void altu(Fl_Widget *, void *) {
  std::cout<<"in alt u"<<std::endl;

int main() {

  Fl_Double_Window *win = new Fl_Double_Window(Fl::w() / 2 - 200, Fl::h() / 2 - 200, 400, 400, "Main Win");

  Fl_Menu_Item items[] = {
      {"Menu1", 0, 0, 0, FL_SUBMENU, 0, 0, FL_NORMAL_SIZE, FL_BLACK}, // 0
      {"cmd f", FL_COMMAND + 'f', ctrlf, NULL, 0, 0, 0, FL_NORMAL_SIZE, FL_BLACK},
      {"cmd g", FL_COMMAND + 'g', ctrlg, NULL, 0, 0, 0, FL_NORMAL_SIZE, FL_BLACK},
      {"cmd i", FL_COMMAND + 'i', ctrli, NULL, 0, 0, 0, FL_NORMAL_SIZE, FL_BLACK},
      {"alt u", FL_ALT + 'u', altu, NULL, 0, 0, 0, FL_NORMAL_SIZE, FL_BLACK},
      {0, 0, 0, 0, 0, 0, 0, 0, 0},
      {0, 0, 0, 0, 0, 0, 0, 0, 0}};

  Fl_Sys_Menu_Bar *menu = new Fl_Sys_Menu_Bar(0, 0, win->w(), 25);
  return Fl::run();



You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/398f41da-d3bd-4b33-aa49-fe85f6c56047n%40googlegroups.com.
Direct Link to Message ]
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.