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
merged 2 commits into from Aug 9, 2016

Conversation

Projects
None yet
3 participants
@kevinsawicki
Contributor

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.

<html>
  <head>
    <style>
      div {
        position: absolute;
        left: 30px;
        top: 30px;
        width: 45px;
        height: 45px;
        background-color: yellow;
        border: 5px solid green;
      }

      body {
        background-color: #f00;
      }
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>
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)

@paulcbetts

This comment has been minimized.

Contributor

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,
region);
RECT rect;

This comment has been minimized.

@zcbenz

zcbenz Aug 9, 2016

Contributor

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

This comment has been minimized.

@kevinsawicki

kevinsawicki Aug 9, 2016

Contributor

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
Details
electron-linux-arm Build #3806986 succeeded in 48s
Details
electron-linux-ia32 Build #3806987 succeeded in 44s
Details
electron-linux-x64 Build #3806988 succeeded in 80s
Details
electron-mas-x64 Build #2157 succeeded in 7 min 13 sec
Details
electron-osx-x64 Build #2155 succeeded in 7 min 44 sec
Details
electron-win-ia32 Build #1177 succeeded in 6 min 40 sec
Details
electron-win-x64 Build #1163 succeeded in 6 min 1 sec
Details

@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