Skip to content

Commit

Permalink
Add basic support for dwmapi and ANIMATIONINFO (#329)
Browse files Browse the repository at this point in the history
* Add basic dwmapi for retrieving window attributes

* Add ANIMATIONINFO structure

* Add missing constants for HRGN types

* Fix compile and link errors in shcore lib

* Fix compile errors in dwmapi, wingdi, winuser
  • Loading branch information
daniel-abramov authored and retep998 committed Dec 16, 2016
1 parent 1179bb2 commit 76a8a4f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/dwmapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ extern "system" {
// pub fn DwmGetGraphicsStreamClient();
// pub fn DwmGetGraphicsStreamTransformHint();
// pub fn DwmGetTransportAttributes();
// pub fn DwmGetWindowAttribute();
pub fn DwmGetWindowAttribute(hWnd: HWND, dwAttribute: DWORD, pvAttribute: LPVOID,
cbAttribute: DWORD) -> HRESULT;
// pub fn DwmInvalidateIconicBitmaps();
// pub fn DwmIsCompositionEnabled();
// pub fn DwmModifyPreviousDxFrameDuration();
Expand Down
4 changes: 2 additions & 2 deletions lib/shcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
extern crate winapi;
use winapi::*;
extern "system" {
pub fn GetDpiForMonitor(hmonitor: HMONITOR, dpiType: MONITOR_DPI_TYPE, dpiX: *UINT, dpiY: *UINT) -> HRESULT
pub fn GetDpiForMonitor(hmonitor: HMONITOR, dpiType: MONITOR_DPI_TYPE, dpiX: *mut UINT, dpiY: *mut UINT) -> HRESULT;
pub fn GetDpiForShellUiComponent(component: SHELL_UI_COMPONENT) -> UINT;
pub fn GetProcessDPIAwareness(hProcess: HANDLE, value: *PROCESS_DPI_AWARENESS) -> HRESULT;
pub fn GetProcessDPIAwareness(hProcess: HANDLE, value: *mut PROCESS_DPI_AWARENESS) -> HRESULT;
pub fn SetProcessDPIAwareness(value: PROCESS_DPI_AWARENESS) -> HRESULT;
pub fn LogicalToPhysicalPointForPerMonitorDPI(hwnd: HWND, lpPoint: LPPOINT) -> BOOL;
pub fn PhysicalToLogicalPointForPerMonitorDPI(hwnd: HWND, lpPoint: LPPOINT) -> BOOL;
Expand Down
17 changes: 17 additions & 0 deletions src/um/dwmapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,20 @@ STRUCT!{struct DWM_BLURBEHIND {
hRgnBlur: HRGN,
fTransitionOnMaximized: BOOL,
}}

pub const DWMWA_NCRENDERING_ENABLED: DWORD = 1;
pub const DWMWA_NCRENDERING_POLICY: DWORD = 2;
pub const DWMWA_TRANSITIONS_FORCEDISABLED: DWORD = 2;
pub const DWMWA_ALLOW_NCPAINT: DWORD = 4;
pub const DWMWA_CAPTION_BUTTON_BOUNDS: DWORD = 5;
pub const DWMWA_NONCLIENT_RTL_LAYOUT: DWORD = 6;
pub const DWMWA_FORCE_ICONIC_REPRESENTATION: DWORD = 7;
pub const DWMWA_FLIP3D_POLICY: DWORD = 8;
pub const DWMWA_EXTENDED_FRAME_BOUNDS: DWORD = 9;
pub const DWMWA_HAS_ICONIC_BITMAP: DWORD = 10;
pub const DWMWA_DISALLOW_PEEK: DWORD = 11;
pub const DWMWA_EXCLUDED_FROM_PEEK: DWORD = 12;
pub const DWMWA_CLOAK: DWORD = 13;
pub const DWMWA_CLOAKED: DWORD = 14;
pub const DWMWA_FREEZE_REPRESENTATION: DWORD = 15;
pub const DWMWA_LAST: DWORD = 16;
5 changes: 5 additions & 0 deletions src/um/wingdi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1249,3 +1249,8 @@ pub const META_CREATEPENINDIRECT: WORD = 0x02FA;
pub const META_CREATEFONTINDIRECT: WORD = 0x02FB;
pub const META_CREATEBRUSHINDIRECT: WORD = 0x02FC;
pub const META_CREATEREGION: WORD = 0x06FF;
pub const ERROR: c_int = 0;
pub const NULLREGION: c_int = 1;
pub const SIMPLEREGION: c_int = 2;
pub const COMPLEXREGION: c_int = 3;
pub const RGN_ERROR: c_int = ERROR;
10 changes: 10 additions & 0 deletions src/um/winuser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2444,3 +2444,13 @@ pub const TPM_VERNEGANIMATION: UINT = 0x2000;
pub const TPM_NOANIMATION: UINT = 0x4000;
pub const TPM_LAYOUTRTL: UINT = 0x8000;
pub const TPM_WORKAREA: UINT = 0x10000;

// ANIMATIONINFO and related fields
STRUCT!{struct ANIMATIONINFO {
cbSize: UINT,
iMinAnimate: c_int,
}}
pub type LPANIMATIONINFO = *mut ANIMATIONINFO;
pub const SPIF_UPDATEINIFILE: UINT = 0x0001;
pub const SPIF_SENDWININICHANGE: UINT = 0x0002;
pub const SPIF_SENDCHANGE: UINT = SPIF_SENDWININICHANGE;

0 comments on commit 76a8a4f

Please sign in to comment.