Skip to content

Commit

Permalink
added OS level API bindings for win32
Browse files Browse the repository at this point in the history
This commit provides a native API binding for win32 to get the ancestor of the
provided window.

Contributes to #62 and #127
  • Loading branch information
amartya4256 committed Jun 6, 2024
1 parent 8e6110b commit 7d2582d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2023 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -2022,6 +2022,18 @@ JNIEXPORT jlong JNICALL OS_NATIVE(GetActiveWindow)
}
#endif

#ifndef NO_GetAncestor
JNIEXPORT jlong JNICALL OS_NATIVE(GetAncestor)
(JNIEnv *env, jclass that, jlong arg0, jint arg1)
{
jlong rc = 0;
OS_NATIVE_ENTER(env, that, GetAncestor_FUNC);
rc = (jlong)GetAncestor((HWND)arg0, arg1);
OS_NATIVE_EXIT(env, that, GetAncestor_FUNC);
return rc;
}
#endif

#ifndef NO_GetBkColor
JNIEXPORT jint JNICALL OS_NATIVE(GetBkColor)
(JNIEnv *env, jclass that, jlong arg0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2023 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -170,6 +170,7 @@ typedef enum {
GdiSetBatchLimit_FUNC,
GetACP_FUNC,
GetActiveWindow_FUNC,
GetAncestor_FUNC,
GetBkColor_FUNC,
GetCapture_FUNC,
GetCaretPos_FUNC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ public class OS extends C {
public static final int FR_PRIVATE = 0x10;
public static final int FSHIFT = 0x4;
public static final int FVIRTKEY = 0x1;
public static final int GA_PARENT = 0x1;
public static final int GA_ROOT = 0x2;
public static final int GA_ROOTOWNER = 0x3;
public static final int GCP_REORDER = 0x0002;
public static final int GCP_GLYPHSHAPE = 0x0010;
public static final int GCP_CLASSIN = 0x00080000;
Expand Down Expand Up @@ -2709,6 +2712,8 @@ public static int HRESULT_FROM_WIN32(int x) {
public static final native int GdiSetBatchLimit (int dwLimit);
public static final native int GetACP ();
public static final native long GetActiveWindow ();
/** @param hWnd cast=(HWND) */
public static final native long GetAncestor (long hWnd, int gaFlags);
/** @param hDC cast=(HDC) */
public static final native int GetBkColor (long hDC);
public static final native long GetCapture ();
Expand Down

0 comments on commit 7d2582d

Please sign in to comment.