mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
cefclient: win: Support window state restore (see issue #3359)
The cefclient sample app on Windows will persist window state across application restart if run with cache_path and persist_user_references enabled. To test: 1. Run `cefclient --cache-path=/path/to/cache --persist-user-preferences` 2. Move or resize the window, maximize, minimize, etc. 3. Exit cefclient. 4. Run cefclient again with the same arguments. The previous window state will be restored.
This commit is contained in:
@@ -75,6 +75,32 @@ CefPoint CefDisplay::ConvertScreenPointFromPixels(const CefPoint& point) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
CefRect CefDisplay::ConvertScreenRectToPixels(const CefRect& rect) {
|
||||
CEF_REQUIRE_UIT_RETURN(CefRect());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
const gfx::Rect pix_rect = view_util::ConvertRectToPixels(
|
||||
gfx::Rect(rect.x, rect.y, rect.width, rect.height));
|
||||
return CefRect(pix_rect.x(), pix_rect.y(), pix_rect.width(),
|
||||
pix_rect.height());
|
||||
#else
|
||||
return rect;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
CefRect CefDisplay::ConvertScreenRectFromPixels(const CefRect& rect) {
|
||||
CEF_REQUIRE_UIT_RETURN(CefRect());
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
const gfx::Rect dip_rect = view_util::ConvertRectFromPixels(
|
||||
gfx::Rect(rect.x, rect.y, rect.width, rect.height));
|
||||
return CefRect(dip_rect.x(), dip_rect.y(), dip_rect.width(),
|
||||
dip_rect.height());
|
||||
#else
|
||||
return rect;
|
||||
#endif
|
||||
}
|
||||
|
||||
CefDisplayImpl::CefDisplayImpl(const display::Display& display)
|
||||
: display_(display) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
@@ -236,6 +236,14 @@ gfx::Point ConvertPointFromPixels(const gfx::Point& point) {
|
||||
gfx::Point ConvertPointToPixels(const gfx::Point& point) {
|
||||
return display::win::ScreenWin::DIPToScreenPoint(point);
|
||||
}
|
||||
|
||||
gfx::Rect ConvertRectFromPixels(const gfx::Rect& rect) {
|
||||
return display::win::ScreenWin::ScreenToDIPRect(nullptr, rect);
|
||||
}
|
||||
|
||||
gfx::Rect ConvertRectToPixels(const gfx::Rect& rect) {
|
||||
return display::win::ScreenWin::DIPToScreenRect(nullptr, rect);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
bool ConvertPointToScreen(views::View* view,
|
||||
|
@@ -97,6 +97,12 @@ gfx::Point ConvertPointFromPixels(const gfx::Point& point);
|
||||
|
||||
// Convert |point| from DIP screen coordinates to pixel screen coordinates.
|
||||
gfx::Point ConvertPointToPixels(const gfx::Point& point);
|
||||
|
||||
// Convert |rect| from pixel screen coordinates to DIP screen coordinates.
|
||||
gfx::Rect ConvertRectFromPixels(const gfx::Rect& rect);
|
||||
|
||||
// Convert |rect| from DIP screen coordinates to pixel screen coordinates.
|
||||
gfx::Rect ConvertRectToPixels(const gfx::Rect& rect);
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
// Convert |point| from |view| to screen coordinates. If |output_pixel_coords|
|
||||
|
Reference in New Issue
Block a user