mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-10 06:31:41 +00:00
In addition to Esc key, the ViewEntityInfo and ViewTextures keys will now hide the floating dialog again
This commit is contained in:
parent
d7fde9f5da
commit
e82eb1e37e
1 changed files with 37 additions and 10 deletions
|
@ -1138,8 +1138,35 @@ static void switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint pag
|
||||||
|
|
||||||
// NOTE: when a key is hit with group window focused, we catch in this handler but it gets propagated to mainframe too
|
// NOTE: when a key is hit with group window focused, we catch in this handler but it gets propagated to mainframe too
|
||||||
// therefore the message will be intercepted and used as a ID_SELECTION_DESELECT
|
// therefore the message will be intercepted and used as a ID_SELECTION_DESELECT
|
||||||
static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
|
static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ) {
|
||||||
if ( ( event->keyval == GDK_Escape ) && ( g_pParentWnd->CurrentStyle() != MainFrame::eFloating ) ) {
|
// make the "ViewTextures" and "ViewEntityInfo" keys that normally bring this dialog up hide it as well - copypasta from mainframe_keypress
|
||||||
|
// NOTE: maybe we could also check the state of the notebook, see if those are actually displayed .. if they are not, then switch the notebook pages rather than hiding?
|
||||||
|
bool hide = false;
|
||||||
|
unsigned int code = gdk_keyval_to_upper( event->keyval );
|
||||||
|
for ( int i = 0; i < g_nCommandCount; i++ ) {
|
||||||
|
if ( g_Commands[i].m_nKey == code ) { // find a match?
|
||||||
|
// check modifiers
|
||||||
|
unsigned int nState = 0;
|
||||||
|
if ( Sys_AltDown() ) {
|
||||||
|
nState |= RAD_ALT;
|
||||||
|
}
|
||||||
|
if ( ( event->state & GDK_CONTROL_MASK ) != 0 ) {
|
||||||
|
nState |= RAD_CONTROL;
|
||||||
|
}
|
||||||
|
if ( ( event->state & GDK_SHIFT_MASK ) != 0 ) {
|
||||||
|
nState |= RAD_SHIFT;
|
||||||
|
}
|
||||||
|
if ( ( g_Commands[i].m_nModifiers & 0x7 ) == nState ) {
|
||||||
|
Sys_Printf( "Floating group dialog: %s\n", g_Commands[i].m_strCommand );
|
||||||
|
if ( g_Commands[i].m_nCommand == ID_VIEW_TEXTURE || g_Commands[i].m_nCommand == ID_VIEW_ENTITY ) {
|
||||||
|
hide = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( g_pParentWnd->CurrentStyle() != MainFrame::eFloating && ( hide || event->keyval == GDK_Escape ) ) {
|
||||||
// toggle off the group view (whatever part of it is currently displayed)
|
// toggle off the group view (whatever part of it is currently displayed)
|
||||||
// this used to be done with a g_pParentWnd->OnViewEntity(); but it had bad consequences
|
// this used to be done with a g_pParentWnd->OnViewEntity(); but it had bad consequences
|
||||||
gtk_widget_hide( widget );
|
gtk_widget_hide( widget );
|
||||||
|
|
Loading…
Reference in a new issue