deduplicated gui list stuff, more keyboard nonsense
This commit is contained in:
parent
60a51a1cc8
commit
6e5bacf154
|
@ -4147,6 +4147,8 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
// TODO(allen): Deduplicate. Perhaps we want a standard list helper?
|
||||
id.id[0] = (u64)(hdir) + 1;
|
||||
if (gui_begin_list(target, id, view->list_i, 0, &update)){
|
||||
gui_standard_list(target, id, &keys, &view->list_i, &update);
|
||||
#if 0
|
||||
if (update.has_adjustment){
|
||||
view->list_i = update.adjustment_value;
|
||||
}
|
||||
|
@ -4171,6 +4173,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
|
||||
gui_rollback(target, &update);
|
||||
gui_begin_list(target, id, view->list_i, indirectly_activate, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -4243,6 +4246,8 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
// TODO(allen): Deduplicate. Perhaps we want a standard list helper?
|
||||
id.id[0] = (u64)(working_set) + 1;
|
||||
if (gui_begin_list(target, id, view->list_i, 0, &update)){
|
||||
gui_standard_list(target, id, &keys, &view->list_i, &update);
|
||||
#if 0
|
||||
if (update.has_adjustment){
|
||||
view->list_i = update.adjustment_value;
|
||||
}
|
||||
|
@ -4267,6 +4272,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
|
||||
gui_rollback(target, &update);
|
||||
gui_begin_list(target, id, view->list_i, indirectly_activate, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
used_nodes = &working_set->used_sentinel;
|
||||
|
|
37
4ed_gui.cpp
37
4ed_gui.cpp
|
@ -967,14 +967,6 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h){
|
|||
end_section = section;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case guicom_text_input:
|
||||
case guicom_file_input:
|
||||
always_give_to_user = 1;
|
||||
do_layout = 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case guicom_color_button:
|
||||
case guicom_font_button:
|
||||
give_to_user = 1;
|
||||
|
@ -1146,5 +1138,34 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h){
|
|||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
gui_standard_list(GUI_Target *target, GUI_id id,
|
||||
Key_Summary *keys, i32 *list_i, GUI_Item_Update *update){
|
||||
if (update->has_adjustment){
|
||||
*list_i = update->adjustment_value;
|
||||
}
|
||||
|
||||
b32 indirectly_activate = 0;
|
||||
for (i32 j = 0; j < keys->count; ++j){
|
||||
i16 key = keys->keys[j].keycode;
|
||||
switch (key){
|
||||
case key_up:
|
||||
--*list_i;
|
||||
break;
|
||||
|
||||
case key_down:
|
||||
++*list_i;
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
indirectly_activate = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_rollback(target, update);
|
||||
gui_begin_list(target, id, *list_i, indirectly_activate, 0);
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
||||
|
|
|
@ -1296,6 +1296,22 @@ Win32Callback(HWND hwnd, UINT uMsg,
|
|||
result2 = 0;
|
||||
}
|
||||
|
||||
// TODO(allen): This is becoming a really major issue. Apparently
|
||||
// control + i outputs a '\t' which is VALID ascii according to this system.
|
||||
// So it reports the key as '\t'. This wasn't an issue before because we were
|
||||
// ignoring control when computing character_no_caps_lock which is what
|
||||
// is used for commands. But that is incorrect for some keyboard layouts where
|
||||
// control+alt is used to signal AltGr for important keys.
|
||||
if (result1 && result2){
|
||||
char c1 = char_to_upper((char)x1);
|
||||
char c2 = char_to_upper((char)x2);
|
||||
char cParam = char_to_upper((char)wParam);
|
||||
|
||||
if (c1 != cParam && c2 == cParam){
|
||||
result1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (result1){
|
||||
x = x1;
|
||||
state[VK_CONTROL] = control_state;
|
||||
|
|
Loading…
Reference in New Issue