Skip to content

Commit

Permalink
refactored foreground message window
Browse files Browse the repository at this point in the history
  • Loading branch information
GChristensen committed Jun 23, 2024
1 parent e2c2223 commit cbca7bb
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 68 deletions.
Binary file modified enso/enso/platform/win32/AsyncEventProcessorRegistry.dll
Binary file not shown.
Binary file modified enso/enso/platform/win32/CLogging.dll
Binary file not shown.
Binary file modified enso/enso/platform/win32/Keyhook.dll
Binary file not shown.
Binary file modified enso/enso/platform/win32/cairo/_cairo.pyd
Binary file not shown.
25 changes: 15 additions & 10 deletions enso/enso/platform/win32/graphics/TransparentWindow.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# !!! This file is edited
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from .utils import setForegroundWindow

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")

# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _TransparentWindow
else:
import _TransparentWindow

import builtins as __builtin__
try:
import builtins as __builtin__
except ImportError:
import __builtin__

def _swig_repr(self):
try:
Expand Down Expand Up @@ -137,15 +141,14 @@ def getMaxWidth(self):
def getMaxHeight(self):
return _TransparentWindow.TransparentWindow_getMaxHeight(self)

def makeCairoSurface(self):
return _TransparentWindow.TransparentWindow_makeCairoSurface(self)

def getHandle(self):
return _TransparentWindow.TransparentWindow_getHandle(self)

def setForeground(self):
handle = self.getHandle()
setForegroundWindow(handle)
return _TransparentWindow.TransparentWindow_setForeground(self)

def makeCairoSurface(self):
return _TransparentWindow.TransparentWindow_makeCairoSurface(self)

# Register TransparentWindow in _TransparentWindow:
_TransparentWindow.TransparentWindow_swigregister(TransparentWindow)
Expand All @@ -155,4 +158,6 @@ def _getDesktopSize():
return _TransparentWindow._getDesktopSize()

def _getDesktopOffset():
return _TransparentWindow._getDesktopOffset()
return _TransparentWindow._getDesktopOffset()


Binary file modified enso/enso/platform/win32/graphics/_TransparentWindow.pyd
Binary file not shown.
57 changes: 0 additions & 57 deletions enso/enso/platform/win32/graphics/utils.py

This file was deleted.

Binary file modified enso/enso/platform/win32/input/_AsyncEventThread.pyd
Binary file not shown.
Binary file modified enso/enso/platform/win32/input/_InputManager.pyd
Binary file not shown.
Binary file modified enso/enso/platform/win32/selection/_ClipboardBackend.pyd
Binary file not shown.
20 changes: 19 additions & 1 deletion platform/win32/Graphics/TransparentWindow/TransparentWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -651,4 +651,22 @@ _getDesktopOffset( int *left,

long long TransparentWindow::getHandle() {
return (long long)_window;
}
}

void TransparentWindow::setForeground() {
DWORD dwCurrentThread = GetCurrentThreadId();
HWND dwFGWindow = GetForegroundWindow();
DWORD dwFGThread = GetWindowThreadProcessId(dwFGWindow, NULL);

AttachThreadInput(dwCurrentThread, dwFGThread, TRUE);

SetWindowPos(_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(_window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);

SetForegroundWindow(_window);
SetFocus(_window);
SetActiveWindow(_window);

AttachThreadInput(dwCurrentThread, dwFGThread, FALSE);
}
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class TransparentWindow
getMaxHeight( void );

long long getHandle();
void setForeground();

#ifndef SWIG
private:
Expand Down

0 comments on commit cbca7bb

Please sign in to comment.