Click Through Blocker

Blocks mouse clicks from going through windows to underlying objects

License: GPLv3

Game Version: 1.10.0

Downloads: 348,228

Author: linuxgurugamer

Mod Website: Forum Thread

Support this mod: Donate

Followers: 324

Outdated Mod

This mod is not known to work with the latest version of Kerbal Space Program. Proceed with caution.

Information Changelog Stats

Having clicked one too many times on one window, only to have it click on the parts underneath (in the Editor), or click on an unwanted item in flight, I decided to solve the problem with yet another mod

Mods which use the Click Through Blocker would need to be modified, and this would become a hard dependency for that mod.

This mod will do NOTHING by itself, it needs to be used by other mods

The changes are very simple:

Replace all calls to GUILayout.Window with ClickThruBlocker.GUILayoutWindow, the parameters are identical Replace all calls to GUI.Window with ClickThruBlocker.GUIWindow, the parameters are identical

How it works

Each call first calls the original method (ie: ClickThruBlocker.GUILayoutWindow will call GUILayout.Window). After the call, the position of the mouse is checked to see if it was on top of the window Rect, if it is, it then locks the controls so that clicks don't pass through to any other window.

Functions - Identical to the GUI and GUILayout versions Rect Window(int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, GUIStyle style, params GUILayoutOption[] options); Rect Window(int id, Rect screenRect, GUI.WindowFunction func, Texture image, GUIStyle style, params GUILayoutOption[] options); Rect Window(int id, Rect screenRect, GUI.WindowFunction func, string text, GUIStyle style, params GUILayoutOption[] options); Rect Window(int id, Rect screenRect, GUI.WindowFunction func, GUIContent content, params GUILayoutOption[] options); Rect Window(int id, Rect screenRect, GUI.WindowFunction func, Texture image, params GUILayoutOption[] options); Rect Window(int id, Rect screenRect, GUI.WindowFunction func, string text, params GUILayoutOption[] options);

Rect Window(int id, Rect clientRect, WindowFunction func, Texture image, GUIStyle style);
Rect Window(int id, Rect clientRect, WindowFunction func, string text, GUIStyle style);
Rect Window(int id, Rect clientRect, WindowFunction func, GUIContent content);
Rect Window(int id, Rect clientRect, WindowFunction func, Texture image);
Rect Window(int id, Rect clientRect, WindowFunction func, string text);
Rect Window(int id, Rect clientRect, WindowFunction func, GUIContent title, GUIStyle style);

Additional functions

bool MouseIsOverWindow(Rect rect) Returns true if the mouse is over the specified rectangle

Version 0.1.10.11 for Kerbal Space Program 1.10.0

Released on 2020-07-16

Fixed overly aggressive CBTMonitor which was causing the vessel highlighting to stop in the editor when FocusFollowsMouse was set

Download (32.74 KiB)

Version 0.1.10.10 for Kerbal Space Program 1.10.0

Released on 2020-07-13

Fix nullrefs upong returning to mainmenu by adding check for no game loaded (ie:  returning to main menu) in CBTMonitor.Update & CBTMonitor.LateUpdate

Download (32.66 KiB)

Version 0.1.10.9 for Kerbal Space Program 1.10.0

Released on 2020-07-12

Fixed Popupshown.cfg from having endless repeats of the popupshown = true appended
Fixed error which caused buildings to be non-clickable if clicking on a control in the window closed it (such as an X or a Close button)
Made all members of Log class to be internal, to avoid conflicts with KSP_Log

Download (32.55 KiB)

Version 0.1.10.6 for Kerbal Space Program 1.10.0

Released on 2020-07-03

Added missing files

Download (32.36 KiB)

Version 1.10.5 for Kerbal Space Program 1.10.0

Released on 2020-07-03

Added Settings page 
Added new setting to specify Focus follows Click
Added code to have the focus follow the click instead of the mouse, for both editor and flight modes
Added initial window to select mode, shows one time only
Modified the CBTMonitor to not run in any scene other than the editor
Fixed window data not getting cleared properly
Removed need to save window rect
Reorganized code a bit
Removed some unnecessary assignments
Added stock settings page to support the FocusFollowsClick mode
Removed need to save window rect
Reorganized code a bit
Removed some unnecessary assignments
Added stock settings page to support the FocusFollowsClick mode
Added cleanup class to cleanup all input locks after a delay, immediately upon changing scenes
Added cleanup delay to settings page

Download (32.06 KiB)

Version 0.1.9.5 for Kerbal Space Program 1.9.0

Released on 2019-12-13

Fixed subtle bug where the game scene was being changed due to clicking on a mod window, which prevented the variable counter: ClickThruBlocker.CTBWin.activeBlockerCnt from being reset to 0 Added check for null EditorLogic.fetch in Update() method, was necessary in KSP 1.8.1 due to change in initialization methods/timings

Download (31.05 KiB)

Version 0.1.9.4 for Kerbal Space Program 1.8.1

Released on 2019-11-19

Fixed nullref which occurred with CRASH
Updated AssemblyVersion.tt

Download (30.75 KiB)

Version 0.1.9.3 for Kerbal Space Program 1.8.1

Released on 2019-10-27

Really did the MiniAVC update

Download (30.72 KiB)

Version 0.1.9.2 for Kerbal Space Program 1.8.0

Released on 2019-10-27

Updated MiniAVC.dll to 1.4.0.2 to fix a nasty CTD

Download (30.66 KiB)

Version 0.1.9.1 for Kerbal Space Program 1.8.0

Released on 2019-10-25

Updated MiniAVC to 1.4.0

Download (30.67 KiB)

Version 0.1.9 for Kerbal Space Program 1.8.0

Released on 2019-10-20

Rebuild for 1.8.0

Download (29.01 KiB)

Version 0.1.7.2 for Kerbal Space Program 1.7.3

Released on 2019-06-24

Added replacements for the following functions:
Unity GUI:
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, string text);
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, Texture image);
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, GUIContent content);
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, string text, GUIStyle style);
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, Texture image, GUIStyle style);
    public static Rect ModalWindow (int id, Rect clientRect, UnityEngine.GUI.WindowFunction func, GUIContent content, GUIStyle style);
Unity GuiLayout:
    public static Rect Window (int id, Rect screenRect, UnityEngine.GUI.WindowFunction func, Texture image, GUIStyle style, params GUILayoutOption[] options);
    public static Rect Window (int id, Rect screenRect, UnityEngine.GUI.WindowFunction func, GUIContent content, GUIStyle style, params GUILayoutOption[] options);

Download (28.66 KiB)

Version 0.1.7.1 for Kerbal Space Program 1.7.0

Released on 2019-03-09

Fixed ArgumentNullException: Argument cannot be null when moving mouse over dropdown menu (in the ksp_toolbar) when in the editor (previous fix was for all other scenes)

Download (28.66 KiB)

Version 0.1.7 for Kerbal Space Program 1.6.1

Released on 2019-02-28

Fixed ArgumentNullException: Argument cannot be null when moving mouse over dropdown menu (in the ksp_toolbar)

Download (28.65 KiB)

Version 0.1.6.10 for Kerbal Space Program 1.6.0

Released on 2019-01-09

No changelog provided

Download (28.62 KiB)

Version 0.1.6.9 for Kerbal Space Program 1.5.1

Released on 2018-10-19

Version bump to fix .version file

Download (27.67 KiB)

Version 0.1.6.8 for Kerbal Space Program 1.5.1

Released on 2018-10-19

Version bump for 1.5 rebuild

Download (27.69 KiB)

Version 0.1.6.7 for Kerbal Space Program 1.4.4

Released on 2018-07-22

Fixed ArgumentOutOfRangeException in Update

Download (27.69 KiB)

Version 0.1.6.6 for Kerbal Space Program 1.4.4

Released on 2018-07-20

Some minor runtime optimizations

Download (27.69 KiB)

Version 0.1.6.5 for Kerbal Space Program 1.4.3

Released on 2018-05-23

Renamed directory, if installing by hand, remove the old directory

Download (25.82 KiB)

Version 0.1.6.3 for Kerbal Space Program 1.4.3

Released on 2018-05-06

Added an additional check to the CBTMonitor for null refs
Reversed order of loops in CBTMonitor for efficiency

Download (25.81 KiB)

Version 0.1.6.2 for Kerbal Space Program 1.4.2

Released on 2018-04-14

Added: [assembly: KSPAssembly("ToolbarController", 1, 0)] to assemblyinfo to allow other mods to check the load order

Download (38.03 KiB)

Version 0.1.6.1 for Kerbal Space Program 1.4.1

Released on 2018-03-29

Updated version file to allow all 1.4.*

Download (38.02 KiB)

Version 0.1.6 for Kerbal Space Program 1.4.1

Released on 2018-03-18

Fix for lock not being released when going from editor to flight (ie: KRASH)

Download (37.99 KiB)

Version 0.1.5 for Kerbal Space Program 1.4.1

Released on 2018-03-16

Changed check of UniversalTime to a tick counter in CBTMonitor, since time doesn't flow in the Editors

Download (35.21 KiB)

Version 0.1.4 for Kerbal Space Program 1.4.1

Released on 2018-03-15

Added fix for nullrefs in CBTMonitor.cs

Download (35.23 KiB)

Version 0.1.3 for Kerbal Space Program 1.4.1

Released on 2018-03-14

Updated for 1.4.1

Download (35.22 KiB)

Version 0.1.2 for Kerbal Space Program 1.3.1

Released on 2018-03-02

Added code to work around stock bug where the editor ignores the lock when the ActionGroup pane is shown

Download (35.10 KiB)

Version 0.1.1.1 for Kerbal Space Program 1.3.1

Released on 2018-02-27

Changed Log class to internal, so it won't interfere with other code compiles

Download (34.67 KiB)

Version 0.1.1 for Kerbal Space Program 1.3.1

Released on 2018-02-24

Fixed bug where closing a window while the mouse was over the window would lock the UI; for example, if a window has an X button to close. Thanks to forum user @keldion for finding this and pointing it out

Download (34.66 KiB)

Version 0.1.0 for Kerbal Space Program 1.3.1

Released on 2018-02-10

No changelog provided

Download (34.35 KiB)

Stats for Click Through Blocker

Downloads over time

    New followers per day

    Top Referrers

    1. forum.kerbalspaceprogram.com
    2. spacedock.info
    3. www.google.com
    4. yandex.ru
    5. duckduckgo.com
    6. www.youtube.com
    7. www.bing.com
    8. www.spacedock.info
    9. www.google.co.uk
    10. kerbalx.com

    Export Raw Stats

    Export Downloads

    Export Followers

    Export Referrals

    Raw stats are from the beginning of time until now. Each follower and download entry represents one hour of data. Uneventful hours are omitted.