Skip to content

Commit 337923f

Browse files
ShahzaibIbrahimakoch-yatta
authored andcommitted
Introducing DwmGetWindowAttribute to retrieve better window position
DwmGetWindowAttribute retrieves the current value of a specified Desktop Window Manager (DWM) attribute applied to a window. To be used later in Replacement of GetWindowRect where applicable.
1 parent cde95ee commit 337923f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -1513,6 +1510,22 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(DuplicateHandle)
15131510
}
15141511
#endif
15151512

1513+
#ifndef NO_DwmGetWindowAttribute
1514+
JNIEXPORT jint JNICALL OS_NATIVE(DwmGetWindowAttribute)
1515+
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jobject arg2, jint arg3)
1516+
{
1517+
RECT _arg2, *lparg2=NULL;
1518+
jint rc = 0;
1519+
OS_NATIVE_ENTER(env, that, DwmGetWindowAttribute_FUNC);
1520+
if (arg2) if ((lparg2 = getRECTFields(env, arg2, &_arg2)) == NULL) goto fail;
1521+
rc = (jint)DwmGetWindowAttribute((HWND)arg0, arg1, lparg2, arg3);
1522+
fail:
1523+
if (arg2 && lparg2) setRECTFields(env, arg2, lparg2);
1524+
OS_NATIVE_EXIT(env, that, DwmGetWindowAttribute_FUNC);
1525+
return rc;
1526+
}
1527+
#endif
1528+
15161529
#ifndef NO_DwmSetWindowAttribute
15171530
JNIEXPORT jboolean JNICALL OS_NATIVE(DwmSetWindowAttribute)
15181531
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jintArray arg2, jint arg3)

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -133,6 +130,7 @@ typedef enum {
133130
DrawThemeBackground_FUNC,
134131
DrawThemeText_FUNC,
135132
DuplicateHandle_FUNC,
133+
DwmGetWindowAttribute_FUNC,
136134
DwmSetWindowAttribute_FUNC,
137135
EMREXTCREATEFONTINDIRECTW_1sizeof_FUNC,
138136
EMR_1sizeof_FUNC,

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ public class OS extends C {
380380
public static final int DTS_SHORTDATEFORMAT = 0x0000;
381381
public static final int DTS_TIMEFORMAT = 0x0009;
382382
public static final int DTS_UPDOWN = 0x0001;
383+
public static final int DWMWA_EXTENDED_FRAME_BOUNDS = 9;
383384
public static final int E_POINTER = 0x80004003;
384385
public static final int EBP_NORMALGROUPBACKGROUND = 5;
385386
public static final int EBP_NORMALGROUPCOLLAPSE = 6;
@@ -3022,6 +3023,8 @@ public static int HRESULT_FROM_WIN32(int x) {
30223023
public static final native boolean GetWindowPlacement (long hWnd, WINDOWPLACEMENT lpwndpl);
30233024
/** @param hWnd cast=(HWND) */
30243025
public static final native boolean GetWindowRect (long hWnd, RECT lpRect);
3026+
/** @param hwnd cast=(HWND) */
3027+
public static final native int DwmGetWindowAttribute (long hwnd, int dwAttribute, RECT pvAttribute, int cbAttribute);
30253028
/**
30263029
* @param hWnd cast=(HWND)
30273030
* @param hRgn cast=(HRGN)

0 commit comments

Comments
 (0)