Commit Graph

155 Commits

Author SHA1 Message Date
Alex Shvartzkop 940f92a44f GAL: improve redraw handling, allowing higher refresh rates.
minRefreshPeriod can't be set in SwitchBackend because OpenGL isn't
initialized yet.
2023-06-17 12:42:22 +03:00
Alex df4fefeb20 Fix view shifting when infobar is shown. 2023-06-02 17:46:46 +03:00
Marek Roszko 5d93487607 Disable IME input on the gal canvas
Fixes #9719
2023-05-09 20:30:15 -04:00
Marek Roszko bfad8bb0d5 Prevent VIEW::UpdateItems and onShowTimer from firing repaints if GAL did not complete init
This appears to be a possible event race on startup

Fixes sentry KICAD-10A
2023-04-11 22:09:05 -04:00
Jeff Young 357427d803 Graphical diff for board vs library footprints.
Fixes https://gitlab.com/kicad/code/kicad/issues/13736
2023-03-10 17:16:40 +00:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Marek Roszko 9647a22e50 Prevent another GAL crash on init due to psuedo-race
Fixes Sentry KICAD-98
2023-02-13 19:10:49 -05:00
Marek Roszko 58350b4521 Ensure gal is initialized before letting DoRepaint blowup spectacularly.
Maybe a fix for KICAD-6B
2023-02-13 07:18:07 -05:00
Jeff Young 4c63b4e061 Class name <-> file name sync. 2022-12-29 18:05:57 +00:00
Alex 4b1994e554 Don't update hidden scrollbars. 2022-11-18 00:33:22 +05:00
Alex dcb131c20d Improve canvas responsiveness by better swap interval management. 2022-11-18 00:32:25 +05:00
Seth Hillbrand 519084546e Ensure dtor throws into catch block
Explicitly destruct the GAL context to get StopDrawing throws in the
proper try block

Fixes https://gitlab.com/kicad/code/kicad/issues/12117
2022-09-29 15:26:39 -07:00
aris-kimi 7bd8cfd7f9 Added common option to hide scrollbars
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9093
2022-09-13 22:15:27 +03:00
Jeff Young 895a8a8dbc Work around focus issues for status popups.
Autoscroll wasn't working on Mac because the status popup's panel
has the focus.  This *may* also fix a problem on MSW of the auto-scroll
not being cancel-able.

Fixes https://gitlab.com/kicad/code/kicad/issues/11425
2022-09-04 21:08:01 +01:00
Seth Hillbrand ee8116e55f Protect against double-refresh
The wxtimer can fire multiple times and there exists the possiblity for
this to happen before the flags are properly set to prevent it.  This
creates a concurrency mutex to skip the EDA_DRAW_PANEL_GAL refresh if
one is already underway.

Fixes https://gitlab.com/kicad/code/kicad/issues/12094

(cherry picked from commit 39dd51490d)
2022-07-27 20:28:48 -07:00
Seth Hillbrand 86ac77258f Don't clear our mutex when drawing
The (lite) mutex protects DoRePaint() from reentry but this breaks if it
is cleared by a timer.

Fixes https://gitlab.com/kicad/code/kicad/issues/12003
2022-07-12 20:10:46 -07:00
Mike Williams 857990a883 Hierarchy: turn into a left side pane
Drop auto-closing option as well.
2022-06-02 21:56:17 +00:00
Marek Roszko b123f7f35f Extra sanity to avoid a gal repaint when not initialized 2022-04-28 18:34:44 -04:00
Roberto Fernandez Bautista 1b6fe615e5 Don't lock OpenGL context twice
Use GAL_DRAWING_CONTEXT as this unlocks the context in its destructor,
so that when an exception is thrown inside the `try` block, it should
automatically unlock before we switch backend.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10840
2022-02-13 21:09:54 +00:00
Alex 4c4089e836 Allow overlay scrolling on GTK, except for GAL canvases.
This prevents glitches when both scrollbars
are visible and scrolling to the end.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10559

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9988
2022-01-31 18:45:47 +03:00
Jeff Young 09d0f6e17c Map zone layers before checking their visibility.
Fixes https://gitlab.com/kicad/code/kicad/issues/10509
2022-01-21 23:26:10 +00:00
Seth Hillbrand c340760eaa Prevent unneeded fallback
Starting in be8327bd54, we assume that all
exceptions in DoRePaint() are caused by OpenGL.  But many calls in
UpdateItems() will throw if there are internal errors such as
std::out_of_range.  Here, we catch those errors and simply skip ahead
rather than falling back to Cairo

(cherry picked from commit 444801ada6)
2022-01-05 13:47:43 -08:00
Jon Evans 014bad7b28 Add profile counters for PCB mouse and paint events 2021-12-05 15:16:08 -05:00
Jon Evans a205595404 PROF_COUNTER -> PROF_TIMER
I want to add an event counter, and this one is a timer
2021-12-05 14:25:37 -05:00
Tomasz Wlostowski cdb214d43a DRAW_PANEL_GAL: remove unused profiling counter 2021-11-29 23:30:10 +01:00
Tomasz Wlostowski f4b25a756d DRAW_PANEL_GAL: add runtime rendering tracing/profiling 2021-11-29 23:30:10 +01:00
Jeff Young b84d1456d5 KIFACE_I -> KIFACE_BASE. 2021-09-14 23:45:14 +01:00
Wayne Stambaugh bcd6bddfd4 Start expunging NULL.
Given that KiCad is a C++ project, we should really be using nullptr
instead of NULL.
2021-07-15 15:44:45 -04:00
jean-pierre charras 1bfa3dc6a5 Fix an annoying issue (wxMSW specific) about X_VIEW_CONTROLS::CaptureCursor()
On MSW, CaptureMouse() was sometimes called event if the GAL panel has
captured the mouse (that was not accepted by wxMSW), although HasCapture()
returns false.
(Perhaps some race condition between events)
The fix add a flag to avoid calling twice CaptureMouse() after only one
wxEVT_MOUSE_CAPTURE_LOST event was received.
Fixes #8239
https://gitlab.com/kicad/code/kicad/issues/8239
2021-04-19 21:23:07 +02:00
Ian McInerney e08387ce3d Make the GAL responsible for the native cursor management
The native cursor must be set on the GAL canvas wx object,
not its frame (otherwise on GTK the cursor is only set
when we get a request for it from the WM and not immediately).

Fixes https://gitlab.com/kicad/code/kicad/issues/6421
2021-04-05 02:36:12 +01:00
Ian McInerney 8ea18c0639 Don't steal focus from other windows on GTK
Before, it was possible for the canvas to steal the
focus if the cursor was only moved over it and not
clicked. Now, the canvas will only take the focus if
the frame is active.

Fixes https://gitlab.com/kicad/code/kicad/issues/7233
2021-04-03 00:17:28 +01:00
Ian McInerney 0a0935e0f3 Remove ACTIONS::TranslateLegacyId and TOOL_DISPATCHER::DispatchWxCommand
After commit 9535153f9e there were no more IDs inside the legacy ID
system. Therefore the entire system for dispatching and looking up
the legacy ideas and handling those events can now be removed and
the tool dispatcher simplified (it no longer needs to know about
the ACTIONS class).
2021-03-30 23:20:22 +00:00
Wayne Stambaugh d96cccbf20 OpenGL GAL tracing improvements. 2021-03-22 17:45:49 -04:00
Wayne Stambaugh be8327bd54 GAL memory allocation fixes.
Vertex memory allocation uses malloc and realloc without checking the
result.  Throw exceptions that can be caught in the DoRepaint() method
in EDA_DRAW_PANEL_GAL when malloc and realloc return a null pointer.
2021-02-22 08:15:09 -05:00
Wayne Stambaugh e7227a4f21 GAL code cleaning. 2021-02-16 17:25:27 -05:00
mitxela 886cad43bd Cancel drag action when focus is lost 2021-01-27 03:33:22 +00:00
Seth Hillbrand ffb3748cfc Don't crash when getting multiple wx calls
Multiple size calls will assert trying to re-lock the GAL context.  Just
skip the second one.
2021-01-09 13:05:58 -08:00
Jon Evans be5102a6e0 Prevent refresh loops on GTK/MSW
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6787

(cherry picked from commit 281180512f)
2020-12-19 15:00:18 -05:00
Jon Evans 93173fca93 Fix refresh logic on MacOS to prevent excessive redraws
This new logic does not need to be MacOS-specific; it should
account for timer inconsistencies on any platform.

Thanks to Mark for the suggestions.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6222
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6332

(cherry picked from commit d79aee3f78)
2020-12-19 15:00:18 -05:00
Jeff Young fc2bdc49de Once more into the depths of hell... er, I mean fix a focus issue.
So the new steals-focus protection stuff works well when there's a
focused control, but not as well when there's a modal dialog up which
happens not to have a focused control (or worse, a focusable control).

This adds a second mechanism for also checking to see if a modal dialog
is up (something that wxWidgets, true to form, makes very difficult).

Fixes https://gitlab.com/kicad/code/kicad/issues/6520
2020-11-26 16:47:40 +00:00
Jeff Young cb5ec8bce1 Make Eeschema cursors update without waiting for mouse movement. 2020-11-18 17:32:40 +00:00
Marek Roszko 262bb06d91 Avoid stealing focus from text controls when hovering over canvas
Fix #4879
Fix #4888
2020-11-04 22:22:45 -05:00
Marek Roszko c372a77d6c Fix focus theft, Windows sends mouse events to windows regardless of focus.
We need to check if the window is foreground before fight over focus which will make the window foreground if it wasn't.

Fixes #4099
Fixes #5958
2020-10-16 23:25:01 -04:00
Marek Roszko f38676fc46 Move the timer fix to the dispatcher to just always run 2020-10-15 00:38:32 -04:00
Marek Roszko 88102bca46 Kick the refresh timer for GAL on Win32 with a terrible hack 2020-10-11 21:44:46 -04:00
Marek Roszko 1739f1b6ea Uninitialized variable (in base class call) 2020-10-11 21:28:07 -04:00
Mark Roszko d9485129c8 Implement more context specific cursors using both stock and custom cursors. 2020-10-08 00:50:28 +00:00
Tomasz Wlostowski bd27d38d9a DRAW_PANEL_GAL: added DebugOverlay() method, creating a temporary overlay for drawing debug graphics 2020-10-07 16:36:37 +02:00
Jeff Young bb753aaadf Clean up terminology around active & high contrast layers. 2020-10-03 22:55:34 +01:00
Tomasz Wlostowski bf9e2de1ac DRAW_PANEL_GAL: don't crash when parent EDA_FRAME is null 2020-10-01 18:55:53 +02:00