// Name: src/gtk/window.cpp
// Purpose: wxWindowGTK implementation
// Author: Robert Roebling
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
KeySym keysym = gdk_event->keyval;
- wxLogTrace(TRACE_KEYS, wxT("Key %s event: keysym = %ld"),
+ wxLogTrace(TRACE_KEYS, wxT("Key %s event: keysym = %lu"),
event.GetEventType() == wxEVT_KEY_UP ? wxT("release")
: wxT("press"),
- keysym);
+ static_cast<unsigned long>(keysym));
long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
wxWindow *wxWindowBase::DoFindFocus()
{
+#if wxUSE_MENUS
// For compatibility with wxMSW, pretend that showing a popup menu doesn't
// change the focus and that it remains on the window showing it, even
// though the real focus does change in GTK.
extern wxMenu *wxCurrentPopupMenu;
if ( wxCurrentPopupMenu )
return wxCurrentPopupMenu->GetInvokingWindow();
+#endif // wxUSE_MENUS
wxWindowGTK *focus = gs_pendingFocus ? gs_pendingFocus : gs_currentFocus;
// the cast is necessary when we compile in wxUniversal mode
// destroy children before destroying this window itself
DestroyChildren();
- if (m_widget)
- Show( false );
-
// delete before the widgets to avoid a crash on solaris
if ( m_imContext )
{
void wxWindowGTK::SetCanFocus(bool canFocus)
{
+ wxCHECK_RET(m_widget, "invalid window");
+
gtk_widget_set_can_focus(m_widget, canFocus);
if ( m_wxwindow && (m_widget != m_wxwindow) )
gtk_get_current_event_time()
);
+ // it is possible for gtk_menu_popup() to fail
+ if (!gtk_widget_get_visible(GTK_WIDGET(menu->m_menu)))
+ {
+ menu->m_popupShown = false;
+ return false;
+ }
+
while (menu->m_popupShown)
{
gtk_main_iteration();