Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/

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

#ifndef NO_DwmGetWindowAttribute
JNIEXPORT jint JNICALL OS_NATIVE(DwmGetWindowAttribute)
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jobject arg2, jint arg3)
{
RECT _arg2, *lparg2=NULL;
jint rc = 0;
OS_NATIVE_ENTER(env, that, DwmGetWindowAttribute_FUNC);
if (arg2) if ((lparg2 = getRECTFields(env, arg2, &_arg2)) == NULL) goto fail;
rc = (jint)DwmGetWindowAttribute((HWND)arg0, arg1, lparg2, arg3);
fail:
if (arg2 && lparg2) setRECTFields(env, arg2, lparg2);
OS_NATIVE_EXIT(env, that, DwmGetWindowAttribute_FUNC);
return rc;
}
#endif

#ifndef NO_DwmSetWindowAttribute
JNIEXPORT jboolean JNICALL OS_NATIVE(DwmSetWindowAttribute)
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jintArray arg2, jint arg3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/

/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
Expand Down Expand Up @@ -133,6 +130,7 @@ typedef enum {
DrawThemeBackground_FUNC,
DrawThemeText_FUNC,
DuplicateHandle_FUNC,
DwmGetWindowAttribute_FUNC,
DwmSetWindowAttribute_FUNC,
EMREXTCREATEFONTINDIRECTW_1sizeof_FUNC,
EMR_1sizeof_FUNC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ public class OS extends C {
public static final int DTS_SHORTDATEFORMAT = 0x0000;
public static final int DTS_TIMEFORMAT = 0x0009;
public static final int DTS_UPDOWN = 0x0001;
public static final int DWMWA_EXTENDED_FRAME_BOUNDS = 9;
public static final int E_POINTER = 0x80004003;
public static final int EBP_NORMALGROUPBACKGROUND = 5;
public static final int EBP_NORMALGROUPCOLLAPSE = 6;
Expand Down Expand Up @@ -3022,6 +3023,8 @@ public static int HRESULT_FROM_WIN32(int x) {
public static final native boolean GetWindowPlacement (long hWnd, WINDOWPLACEMENT lpwndpl);
/** @param hWnd cast=(HWND) */
public static final native boolean GetWindowRect (long hWnd, RECT lpRect);
/** @param hwnd cast=(HWND) */
public static final native int DwmGetWindowAttribute (long hwnd, int dwAttribute, RECT pvAttribute, int cbAttribute);
/**
* @param hWnd cast=(HWND)
* @param hRgn cast=(HRGN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,12 @@ public int getImeInputMode () {

@Override Point getLocationInPixels () {
if (OS.IsIconic (handle)) return super.getLocationInPixels ();
RECT rect = new RECT ();
OS.GetWindowRect (handle, rect);
return new Point (rect.left, rect.top);
RECT rect = new RECT();
int hr = OS.DwmGetWindowAttribute(handle, OS.DWMWA_EXTENDED_FRAME_BOUNDS, rect, RECT.sizeof);
if (hr != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To improve comprehensibility:

Suggested change
if (hr != 0) {
if (hr != OS.S_OK) {

OS.GetWindowRect(handle, rect);
}
return new Point(rect.left, rect.top);
}

@Override
Expand Down
Loading