Skip to content

Commit

Permalink
X buttons to close popups
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Feb 24, 2025
1 parent 9e5e354 commit a2bd9b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Added:
- Drag click to select items in address list and scratchpad
- Confirm dialog box when detaching process with an active search or addresses in scratchpad
- X buttons to close popups like clicking cancel

### Updated:
- Use custom `thread_cancel()` implementation that is more portable and works with `-fexceptions`
Expand Down
10 changes: 6 additions & 4 deletions src/gui/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ static void gui_window_draw_attach_process_popup(Gui* gui) {
(ImVec2){display.x / 2.0f, display.y / 2.0f},
ImGuiCond_Always,
(ImVec2){0.5f, 0.5f});
bool popup_still_open = true;
if(ImGui_BeginPopupModal(
attach_process,
NULL,
&popup_still_open,
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_AlwaysAutoResize)) {
static ProcessList* list = NULL;
Expand Down Expand Up @@ -119,7 +120,7 @@ static void gui_window_draw_attach_process_popup(Gui* gui) {
ImGui_EndDisabled();

ImGui_SameLine();
if(ImGui_Button(cancel)) {
if(ImGui_Button(cancel) || !popup_still_open) {
process_list_free(list);
list = NULL;
ImGui_CloseCurrentPopup();
Expand All @@ -135,9 +136,10 @@ static void gui_window_draw_detach_process_popup(Gui* gui) {
(ImVec2){display.x / 2.0f, display.y / 2.0f},
ImGuiCond_Always,
(ImVec2){0.5f, 0.5f});
bool popup_still_open = true;
if(ImGui_BeginPopupModal(
detach_process,
NULL,
&popup_still_open,
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui_TextUnformatted("Are you sure you want to detach from the process?");
Expand All @@ -160,7 +162,7 @@ static void gui_window_draw_detach_process_popup(Gui* gui) {
}

ImGui_SameLine();
if(ImGui_Button(cancel)) {
if(ImGui_Button(cancel) || !popup_still_open) {
ImGui_CloseCurrentPopup();
}

Expand Down

0 comments on commit a2bd9b9

Please sign in to comment.