Skip to content
Merged
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
39 changes: 0 additions & 39 deletions bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,21 +1421,6 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(DrawFocusRect)
}
#endif

#ifndef NO_DrawFrameControl
JNIEXPORT jboolean JNICALL OS_NATIVE(DrawFrameControl)
(JNIEnv *env, jclass that, jlong arg0, jobject arg1, jint arg2, jint arg3)
{
RECT _arg1, *lparg1=NULL;
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, DrawFrameControl_FUNC);
if (arg1) if ((lparg1 = getRECTFields(env, arg1, &_arg1)) == NULL) goto fail;
rc = (jboolean)DrawFrameControl((HDC)arg0, lparg1, arg2, arg3);
fail:
OS_NATIVE_EXIT(env, that, DrawFrameControl_FUNC);
return rc;
}
#endif

#ifndef NO_DrawIconEx
JNIEXPORT jboolean JNICALL OS_NATIVE(DrawIconEx)
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jlong arg3, jint arg4, jint arg5, jint arg6, jlong arg7, jint arg8)
Expand Down Expand Up @@ -3880,18 +3865,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(ImageList_1Add)
}
#endif

#ifndef NO_ImageList_1AddMasked
JNIEXPORT jint JNICALL OS_NATIVE(ImageList_1AddMasked)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jint arg2)
{
jint rc = 0;
OS_NATIVE_ENTER(env, that, ImageList_1AddMasked_FUNC);
rc = (jint)ImageList_AddMasked((HIMAGELIST)arg0, (HBITMAP)arg1, (COLORREF)arg2);
OS_NATIVE_EXIT(env, that, ImageList_1AddMasked_FUNC);
return rc;
}
#endif

#ifndef NO_ImageList_1BeginDrag
JNIEXPORT jboolean JNICALL OS_NATIVE(ImageList_1BeginDrag)
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jint arg3)
Expand Down Expand Up @@ -4442,18 +4415,6 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(InvalidateRgn)
}
#endif

#ifndef NO_IsAppThemed
JNIEXPORT jboolean JNICALL OS_NATIVE(IsAppThemed)
(JNIEnv *env, jclass that)
{
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, IsAppThemed_FUNC);
rc = (jboolean)IsAppThemed();
OS_NATIVE_EXIT(env, that, IsAppThemed_FUNC);
return rc;
}
#endif

#ifndef NO_IsHungAppWindow
JNIEXPORT jboolean JNICALL OS_NATIVE(IsHungAppWindow)
(JNIEnv *env, jclass that, jlong arg0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ typedef enum {
DragQueryFile_FUNC,
DrawEdge_FUNC,
DrawFocusRect_FUNC,
DrawFrameControl_FUNC,
DrawIconEx_FUNC,
DrawMenuBar_FUNC,
DrawText_FUNC,
Expand Down Expand Up @@ -304,7 +303,6 @@ typedef enum {
INITCOMMONCONTROLSEX_1sizeof_FUNC,
INPUT_1sizeof_FUNC,
ImageList_1Add_FUNC,
ImageList_1AddMasked_FUNC,
ImageList_1BeginDrag_FUNC,
ImageList_1Create_FUNC,
ImageList_1Destroy_FUNC,
Expand Down Expand Up @@ -344,7 +342,6 @@ typedef enum {
IntersectRect_FUNC,
InvalidateRect_FUNC,
InvalidateRgn_FUNC,
IsAppThemed_FUNC,
IsDarkModeAvailable_FUNC,
IsHungAppWindow_FUNC,
IsIconic_FUNC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,12 @@ public class OS extends C {
public static final int BST_INDETERMINATE = 0x2;
public static final int BST_UNCHECKED = 0x0;
public static final int BS_3STATE = 0x5;
public static final int BS_BITMAP = 0x80;
public static final int BS_CENTER = 0x300;
public static final int BS_CHECKBOX = 0x2;
public static final int BS_COMMANDLINK = 0xe;
public static final int BS_DEFPUSHBUTTON = 0x1;
public static final int BS_FLAT = 0x8000;
public static final int BS_GROUPBOX = 0x7;
public static final int BS_ICON = 0x40;
public static final int BS_LEFT = 0x100;
public static final int BS_MULTILINE = 0x2000;
public static final int BS_NOTIFY = 0x4000;
Expand Down Expand Up @@ -309,17 +307,7 @@ public class OS extends C {
public static final int DCX_CACHE = 0x2;
public static final int DEFAULT_CHARSET = 0x1;
public static final int DEFAULT_GUI_FONT = 0x11;
public static final int DFCS_BUTTONCHECK = 0x0;
public static final int DFCS_CHECKED = 0x400;
public static final int DFCS_FLAT = 0x4000;
public static final int DFCS_INACTIVE = 0x100;
public static final int DFCS_PUSHED = 0x200;
public static final int DFCS_SCROLLDOWN = 0x1;
public static final int DFCS_SCROLLLEFT = 0x2;
public static final int DFCS_SCROLLRIGHT = 0x3;
public static final int DFCS_SCROLLUP = 0x0;
public static final int DFC_BUTTON = 0x4;
public static final int DFC_SCROLL = 0x3;

public static final int DIB_RGB_COLORS = 0x0;
public static final int DI_NORMAL = 0x3;
public static final int DI_NOMIRROR = 0x10;
Expand Down Expand Up @@ -2605,11 +2593,7 @@ public static int HRESULT_FROM_WIN32(int x) {
* @param lpRect flags=no_out
*/
public static final native boolean DrawFocusRect (long hDC, RECT lpRect);
/**
* @param hdc cast=(HDC)
* @param lprc flags=no_out
*/
public static final native boolean DrawFrameControl (long hdc, RECT lprc, int uType, int uState);

/**
* @param hdc cast=(HDC)
* @param hIcon cast=(HICON)
Expand Down Expand Up @@ -3108,12 +3092,7 @@ public static int HRESULT_FROM_WIN32(int x) {
* @param hbmMask cast=(HBITMAP)
*/
public static final native int ImageList_Add (long himl, long hbmImage, long hbmMask);
/**
* @param himl cast=(HIMAGELIST)
* @param hbmImage cast=(HBITMAP)
* @param crMask cast=(COLORREF)
*/
public static final native int ImageList_AddMasked (long himl, long hbmImage, int crMask);

/** @param himl cast=(HIMAGELIST) */
public static final native boolean ImageList_BeginDrag (long himl, int iTrack, int dxHotspot, int dyHotspot);
public static final native long ImageList_Create (int cx, int cy, int flags, int cInitial, int cGrow);
Expand Down Expand Up @@ -3254,7 +3233,6 @@ public static int HRESULT_FROM_WIN32(int x) {
* @param hRgn cast=(HRGN)
*/
public static final native boolean InvalidateRgn (long hWnd, long hRgn, boolean bErase);
public static final native boolean IsAppThemed ();
/** @method flags=no_gen */
public static final native boolean IsDarkModeAvailable();
/** @param hWnd cast=(HWND) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,6 @@ void _setText (String text) {
* is disabled, the first pixel of the text is clipped. The fix
* is to append a space to the text.
*/
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
if (!OS.IsAppThemed ()) {
text = OS.IsWindowEnabled (handle) ? text : text + " ";
}
}
TCHAR buffer = new TCHAR (getCodePage (), text, true);
OS.SetWindowText (handle, buffer);
if ((state & HAS_AUTO_DIRECTION) != 0) {
Expand Down Expand Up @@ -391,12 +386,6 @@ Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
} else {
rect.right -= 6;
}
if (!OS.IsAppThemed ()) {
rect.right -= 2;
if (isRadioOrCheck()) {
rect.right -= 2;
}
}
}
OS.DrawText (hDC, buffer, buffer.length, rect, flags);
width += rect.right - rect.left;
Expand Down Expand Up @@ -436,37 +425,31 @@ void createHandle () {
super.createHandle ();
parent.state &= ~IGNORE_WM_CHANGEUISTATE;

if (OS.IsAppThemed ()) {
/* Set the theme background.
*
* NOTE: On Vista this causes problems when the tab
* key is pressed for push buttons so disable the
* theme background drawing for these widgets for
* now.
*/
if ((style & (SWT.PUSH | SWT.TOGGLE)) == 0) {
state |= THEME_BACKGROUND;
}

/*
* Bug in Windows. For some reason, the HBRUSH that
* is returned from WM_CTRLCOLOR is misaligned when
* the button uses it to draw. If the brush is a solid
* color, this does not matter. However, if the brush
* contains an image, the image is misaligned. The
* fix is to draw the background in WM_CTRLCOLOR.
*
* NOTE: For comctl32.dll 6.0 with themes disabled,
* drawing in WM_ERASEBKGND will draw on top of the
* text of the control.
*/
if ((style & SWT.RADIO) != 0) {
state |= DRAW_BACKGROUND;
}
/* Set the theme background.
*
* NOTE: On Vista this causes problems when the tab
* key is pressed for push buttons so disable the
* theme background drawing for these widgets for
* now.
*/
if ((style & (SWT.PUSH | SWT.TOGGLE)) == 0) {
state |= THEME_BACKGROUND;
}

useDarkModeExplorerTheme = display.useDarkModeExplorerTheme;
maybeEnableDarkSystemTheme();
/*
* Bug in Windows. For some reason, the HBRUSH that
* is returned from WM_CTRLCOLOR is misaligned when
* the button uses it to draw. If the brush is a solid
* color, this does not matter. However, if the brush
* contains an image, the image is misaligned. The
* fix is to draw the background in WM_CTRLCOLOR.
*/
if ((style & SWT.RADIO) != 0) {
state |= DRAW_BACKGROUND;
}

useDarkModeExplorerTheme = display.useDarkModeExplorerTheme;
maybeEnableDarkSystemTheme();
}

private boolean customBackgroundDrawing() {
Expand Down Expand Up @@ -498,22 +481,6 @@ int defaultForeground () {
void enableWidget (boolean enabled) {
super.enableWidget (enabled);
/*
* Bug in Windows. When a Button control is right-to-left and
* is disabled, the first pixel of the text is clipped. The fix
* is to append a space to the text.
*/
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
if (!OS.IsAppThemed ()) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
boolean hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) != 0;
if (!hasImage) {
String string = enabled ? text : text + " ";
TCHAR buffer = new TCHAR (getCodePage (), string, true);
OS.SetWindowText (handle, buffer);
}
}
}
/*
* Bug in Windows. When a button has the style BS_CHECKBOX
* or BS_RADIOBUTTON, is checked, and is displaying both an
* image and some text, when BCM_SETIMAGELIST is used to
Expand Down Expand Up @@ -1257,9 +1224,7 @@ LRESULT WM_UPDATEUISTATE (long wParam, long lParam) {
boolean redraw = findImageControl () != null;
if (!redraw) {
if ((state & THEME_BACKGROUND) != 0) {
if (OS.IsAppThemed ()) {
redraw = findThemeControl () != null;
}
redraw = findThemeControl () != null;
}
if (!redraw) redraw = findBackgroundControl () != null;
}
Expand Down Expand Up @@ -1311,12 +1276,8 @@ private int getCheckboxTextOffset(long hdc) {

SIZE size = new SIZE();

if (OS.IsAppThemed ()) {
OS.GetThemePartSize(display.hButtonTheme(nativeZoom), hdc, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, null, OS.TS_TRUE, size);
result += size.cx;
} else {
result += DPIUtil.pointToPixel(13, nativeZoom);
}
OS.GetThemePartSize(display.hButtonTheme(nativeZoom), hdc, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, null, OS.TS_TRUE, size);
result += size.cx;

// Windows uses half width of '0' as checkbox-to-text distance.
OS.GetTextExtentPoint32(hdc, STRING_WITH_ZERO_CHAR, 1, size);
Expand Down Expand Up @@ -1540,24 +1501,10 @@ LRESULT wmDrawChild (long wParam, long lParam) {
OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
RECT rect = new RECT ();
OS.SetRect (rect, struct.left, struct.top, struct.right, struct.bottom);
if (OS.IsAppThemed ()) {
boolean pressed = ((struct.itemState & OS.ODS_SELECTED) != 0);
boolean enabled = getEnabled ();
int iStateId = getThemeStateId(style, pressed, enabled);
OS.DrawThemeBackground (display.hScrollBarThemeAuto(nativeZoom), struct.hDC, OS.SBP_ARROWBTN, iStateId, rect, null);
} else {
int uState = OS.DFCS_SCROLLLEFT;
switch (style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) {
case SWT.UP: uState = OS.DFCS_SCROLLUP; break;
case SWT.DOWN: uState = OS.DFCS_SCROLLDOWN; break;
case SWT.LEFT: uState = OS.DFCS_SCROLLLEFT; break;
case SWT.RIGHT: uState = OS.DFCS_SCROLLRIGHT; break;
}
if (!getEnabled ()) uState |= OS.DFCS_INACTIVE;
if ((style & SWT.FLAT) == SWT.FLAT) uState |= OS.DFCS_FLAT;
if ((struct.itemState & OS.ODS_SELECTED) != 0) uState |= OS.DFCS_PUSHED;
OS.DrawFrameControl (struct.hDC, rect, OS.DFC_SCROLL, uState);
}
boolean pressed = ((struct.itemState & OS.ODS_SELECTED) != 0);
boolean enabled = getEnabled ();
int iStateId = getThemeStateId(style, pressed, enabled);
OS.DrawThemeBackground (display.hScrollBarThemeAuto(nativeZoom), struct.hDC, OS.SBP_ARROWBTN, iStateId, rect, null);
return null;
}

Expand Down
Loading
Loading