0

I'm building a project like uLauncher where I can pop out a window and focus on the textbox right away. I was able to get the window out using libkeybinder for the shortcut and get the window out with win->show(), but the problem is that the keyboard cursor is in the window behind the window.

How do I get the focus to be on the textbox window?

This is the main code:

void shortcutHandler(const char *keystring, void *user_data) {
  winroot->show();
}

int main(int argc, char *argv[]) {
  Gtk::Main kit(argc, argv);

  winroot = new MainWindow();
  auto app = Gtk::Application::create(GTK_ID);
  app->hold();

  keybinder_init();
  keybinder_bind(KEY_SHORTCUT, shortcutHandler, NULL);

  return app->run(*winroot);
}
``

0 Answers0