New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert DIP to screen rect for thumbnail clip #6782

merged 2 commits into from Aug 9, 2016


None yet
3 participants

kevinsawicki commented Aug 8, 2016

Use DIPToScreenRect to convert specified region to screen coordinates.

The following app and screenshots show it previously broken but not correctly positioning the thumbnail region.

      div {
        position: absolute;
        left: 30px;
        top: 30px;
        width: 45px;
        height: 45px;
        background-color: yellow;
        border: 5px solid green;

      body {
        background-color: #f00;
require('electron').remote.getCurrentWindow().setThumbnailClip({x: 30, y: 30, width: 55, height: 55})
Before After
screen shot 2016-08-08 at 2 04 47 pm screen shot 2016-08-08 at 2 04 00 pm

Big thanks for @paulcbetts for bringing this up over on #6497 (comment)


This comment has been minimized.


paulcbetts commented Aug 9, 2016

@@ -149,11 +150,13 @@ bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) {
if (region.IsEmpty()) {
return SUCCEEDED(taskbar_->SetThumbnailClip(window, NULL));
} else {
gfx::Rect screen_rect = display::win::ScreenWin::DIPToScreenRect(window,
RECT rect;

This comment has been minimized.


zcbenz Aug 9, 2016


gfx::Rect has a ToRECT method to convert it to RECT directly.

This comment has been minimized.


kevinsawicki Aug 9, 2016


Oh awesome, will update to that 👍

@kevinsawicki kevinsawicki merged commit ab0d726 into master Aug 9, 2016

7 of 8 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
electron-linux-arm Build #3806986 succeeded in 48s
electron-linux-ia32 Build #3806987 succeeded in 44s
electron-linux-x64 Build #3806988 succeeded in 80s
electron-mas-x64 Build #2157 succeeded in 7 min 13 sec
electron-osx-x64 Build #2155 succeeded in 7 min 44 sec
electron-win-ia32 Build #1177 succeeded in 6 min 40 sec
electron-win-x64 Build #1163 succeeded in 6 min 1 sec

@kevinsawicki kevinsawicki deleted the dip-thumbnail-clip branch Aug 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment