Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin2019-03-28 11:23:52 +0000
committerNiraj Modi2019-05-13 05:52:28 +0000
commitf804009794bd9f8d72782079d13adf55fdb5ef02 (patch)
tree44ac66f0733edbeb58bdc7212fa95aeb31600d66
parent461060f5b0570c7ad06157b8a3ea8894f3d1d545 (diff)
downloadeclipse.platform.swt-f804009794bd9f8d72782079d13adf55fdb5ef02.tar.gz
eclipse.platform.swt-f804009794bd9f8d72782079d13adf55fdb5ef02.tar.xz
eclipse.platform.swt-f804009794bd9f8d72782079d13adf55fdb5ef02.zip
Bug 546835 - [Win32] Remove application palette management
When running on a 8-bit (indexed) display, applications will be limited to the default 20-color palette. Change-Id: I4878aa17b63f55e4a6c8300e13f74c6728a700f2 Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c102
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java53
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java70
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java30
11 files changed, 5 insertions, 359 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
index 847883ef4c..2e8de20233 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java
@@ -520,7 +520,7 @@ public Color getBackground () {
if (varBackColor != null){
int[] colorRef = new int[1];
- if (COM.OleTranslateColor(varBackColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
+ if (COM.OleTranslateColor(varBackColor.getInt(), 0, colorRef) == COM.S_OK)
return Color.win32_new(getDisplay(), colorRef[0]);
}
}
@@ -568,7 +568,7 @@ public Color getForeground () {
if (varForeColor != null){
int[] colorRef = new int[1];
- if (COM.OleTranslateColor(varForeColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK)
+ if (COM.OleTranslateColor(varForeColor.getInt(), 0, colorRef) == COM.S_OK)
return Color.win32_new(getDisplay(), colorRef[0]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
index ee960d35cb..ed1dad625c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1118,22 +1118,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(CreateMenu)
}
#endif
-#ifndef NO_CreatePalette
-JNIEXPORT jintLong JNICALL OS_NATIVE(CreatePalette)
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, CreatePalette_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
- rc = (jintLong)CreatePalette((LOGPALETTE *)lparg0);
-fail:
- if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT);
- OS_NATIVE_EXIT(env, that, CreatePalette_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_CreatePatternBrush
JNIEXPORT jintLong JNICALL OS_NATIVE(CreatePatternBrush)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -3230,18 +3214,6 @@ fail:
}
#endif
-#ifndef NO_GetNearestPaletteIndex
-JNIEXPORT jint JNICALL OS_NATIVE(GetNearestPaletteIndex)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
-{
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, GetNearestPaletteIndex_FUNC);
- rc = (jint)GetNearestPaletteIndex((HPALETTE)arg0, (COLORREF)arg1);
- OS_NATIVE_EXIT(env, that, GetNearestPaletteIndex_FUNC);
- return rc;
-}
-#endif
-
#if (!defined(NO_GetObject__III) && !defined(JNI64)) || (!defined(NO_GetObject__JIJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT jint JNICALL OS_NATIVE(GetObject__III)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2)
@@ -3405,22 +3377,6 @@ fail:
}
#endif
-#ifndef NO_GetPaletteEntries
-JNIEXPORT jint JNICALL OS_NATIVE(GetPaletteEntries)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, GetPaletteEntries_FUNC);
- if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail;
- rc = (jint)GetPaletteEntries((HPALETTE)arg0, arg1, arg2, (LPPALETTEENTRY)lparg3);
-fail:
- if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, 0);
- OS_NATIVE_EXIT(env, that, GetPaletteEntries_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GetParent
JNIEXPORT jintLong JNICALL OS_NATIVE(GetParent)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -3696,22 +3652,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(GetSystemMetrics)
}
#endif
-#ifndef NO_GetSystemPaletteEntries
-JNIEXPORT jint JNICALL OS_NATIVE(GetSystemPaletteEntries)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, GetSystemPaletteEntries_FUNC);
- if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail;
- rc = (jint)GetSystemPaletteEntries((HDC)arg0, (UINT)arg1, (UINT)arg2, (LPPALETTEENTRY)lparg3);
-fail:
- if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, 0);
- OS_NATIVE_EXIT(env, that, GetSystemPaletteEntries_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GetTextColor
JNIEXPORT jint JNICALL OS_NATIVE(GetTextColor)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -8555,18 +8495,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(RECT_1sizeof)
}
#endif
-#ifndef NO_RealizePalette
-JNIEXPORT jint JNICALL OS_NATIVE(RealizePalette)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, RealizePalette_FUNC);
- rc = (jint)RealizePalette((HDC)arg0);
- OS_NATIVE_EXIT(env, that, RealizePalette_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_RectInRegion
JNIEXPORT jboolean JNICALL OS_NATIVE(RectInRegion)
(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
@@ -9759,18 +9687,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(SelectObject)
}
#endif
-#ifndef NO_SelectPalette
-JNIEXPORT jintLong JNICALL OS_NATIVE(SelectPalette)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2)
-{
- jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, SelectPalette_FUNC);
- rc = (jintLong)SelectPalette((HDC)arg0, (HPALETTE)arg1, arg2);
- OS_NATIVE_EXIT(env, that, SelectPalette_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_SendInput
JNIEXPORT jint JNICALL OS_NATIVE(SendInput)
(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2)
@@ -10908,22 +10824,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(SetMetaRgn)
}
#endif
-#ifndef NO_SetPaletteEntries
-JNIEXPORT jint JNICALL OS_NATIVE(SetPaletteEntries)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jbyteArray arg3)
-{
- jbyte *lparg3=NULL;
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, SetPaletteEntries_FUNC);
- if (arg3) if ((lparg3 = (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) == NULL) goto fail;
- rc = (jint)SetPaletteEntries((HPALETTE)arg0, arg1, arg2, (PALETTEENTRY *)lparg3);
-fail:
- if (arg3 && lparg3) (*env)->ReleasePrimitiveArrayCritical(env, arg3, lparg3, JNI_ABORT);
- OS_NATIVE_EXIT(env, that, SetPaletteEntries_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_SetParent
JNIEXPORT jintLong JNICALL OS_NATIVE(SetParent)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
index 6713d7da63..94546b87c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -110,7 +110,6 @@ char * OS_nativeFunctionNames[] = {
"CreateFontIndirect__Lorg_eclipse_swt_internal_win32_LOGFONT_2",
"CreateIconIndirect",
"CreateMenu",
- "CreatePalette",
"CreatePatternBrush",
"CreatePen",
"CreatePolygonRgn",
@@ -260,7 +259,6 @@ char * OS_nativeFunctionNames[] = {
"GetModuleFileName",
"GetModuleHandle",
"GetMonitorInfo",
- "GetNearestPaletteIndex",
#ifndef JNI64
"GetObject__III",
#else
@@ -288,7 +286,6 @@ char * OS_nativeFunctionNames[] = {
#endif
"GetOpenFileName",
"GetOutlineTextMetrics",
- "GetPaletteEntries",
"GetParent",
"GetPixel",
"GetPolyFillMode",
@@ -309,7 +306,6 @@ char * OS_nativeFunctionNames[] = {
"GetSystemDefaultUILanguage",
"GetSystemMenu",
"GetSystemMetrics",
- "GetSystemPaletteEntries",
"GetTextColor",
"GetTextExtentPoint32",
"GetTextMetrics",
@@ -963,7 +959,6 @@ char * OS_nativeFunctionNames[] = {
"PtInRegion",
"REBARBANDINFO_1sizeof",
"RECT_1sizeof",
- "RealizePalette",
"RectInRegion",
"Rectangle",
"RedrawWindow",
@@ -1045,7 +1040,6 @@ char * OS_nativeFunctionNames[] = {
"ScrollWindowEx",
"SelectClipRgn",
"SelectObject",
- "SelectPalette",
"SendInput",
#ifndef JNI64
"SendMessage__IIII",
@@ -1220,7 +1214,6 @@ char * OS_nativeFunctionNames[] = {
"SetMenuInfo",
"SetMenuItemInfo",
"SetMetaRgn",
- "SetPaletteEntries",
"SetParent",
"SetPixel",
"SetPolyFillMode",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
index 8e2fb4ee60..c5df36e115 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -120,7 +120,6 @@ typedef enum {
CreateFontIndirect__Lorg_eclipse_swt_internal_win32_LOGFONT_2_FUNC,
CreateIconIndirect_FUNC,
CreateMenu_FUNC,
- CreatePalette_FUNC,
CreatePatternBrush_FUNC,
CreatePen_FUNC,
CreatePolygonRgn_FUNC,
@@ -270,7 +269,6 @@ typedef enum {
GetModuleFileName_FUNC,
GetModuleHandle_FUNC,
GetMonitorInfo_FUNC,
- GetNearestPaletteIndex_FUNC,
#ifndef JNI64
GetObject__III_FUNC,
#else
@@ -298,7 +296,6 @@ typedef enum {
#endif
GetOpenFileName_FUNC,
GetOutlineTextMetrics_FUNC,
- GetPaletteEntries_FUNC,
GetParent_FUNC,
GetPixel_FUNC,
GetPolyFillMode_FUNC,
@@ -319,7 +316,6 @@ typedef enum {
GetSystemDefaultUILanguage_FUNC,
GetSystemMenu_FUNC,
GetSystemMetrics_FUNC,
- GetSystemPaletteEntries_FUNC,
GetTextColor_FUNC,
GetTextExtentPoint32_FUNC,
GetTextMetrics_FUNC,
@@ -973,7 +969,6 @@ typedef enum {
PtInRegion_FUNC,
REBARBANDINFO_1sizeof_FUNC,
RECT_1sizeof_FUNC,
- RealizePalette_FUNC,
RectInRegion_FUNC,
Rectangle_FUNC,
RedrawWindow_FUNC,
@@ -1055,7 +1050,6 @@ typedef enum {
ScrollWindowEx_FUNC,
SelectClipRgn_FUNC,
SelectObject_FUNC,
- SelectPalette_FUNC,
SendInput_FUNC,
#ifndef JNI64
SendMessage__IIII_FUNC,
@@ -1230,7 +1224,6 @@ typedef enum {
SetMenuInfo_FUNC,
SetMenuItemInfo_FUNC,
SetMetaRgn_FUNC,
- SetPaletteEntries_FUNC,
SetParent_FUNC,
SetPixel_FUNC,
SetPolyFillMode_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index a3d5f93cba..19de3759b3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1044,7 +1044,6 @@ public class OS extends C {
public static final int NULLREGION = 0x1;
public static final int NULL_BRUSH = 0x5;
public static final int NULL_PEN = 0x8;
- public static final int NUMRESERVED = 106;
public static final int OBJID_WINDOW = 0x00000000;
public static final int OBJID_SYSMENU = 0xFFFFFFFF;
public static final int OBJID_TITLEBAR = 0xFFFFFFFE;
@@ -1210,7 +1209,6 @@ public class OS extends C {
public static final int RB_SETBANDINFO = 0x40b;
public static final int RB_SETBKCOLOR = 0x413;
public static final int RB_SETTEXTCOLOR = 0x415;
- public static final int RC_PALETTE = 0x100;
public static final int RDW_ALLCHILDREN = 0x80;
public static final int RDW_ERASE = 0x4;
public static final int RDW_FRAME = 0x400;
@@ -1288,7 +1286,6 @@ public class OS extends C {
public static final int SIZE_RESTORED = 0;
public static final int SIZE_MINIMIZED = 1;
public static final int SIZE_MAXIMIZED = 2;
- public static final int SIZEPALETTE = 104;
public static final int SM_CMONITORS = 80;
public static final int SM_CXBORDER = 0x5;
public static final int SM_CXCURSOR = 0xd;
@@ -1900,13 +1897,11 @@ public class OS extends C {
public static final int WM_NOTIFY = 0x4e;
public static final int WM_NULL = 0x0;
public static final int WM_PAINT = 0xf;
- public static final int WM_PALETTECHANGED = 0x311;
public static final int WM_PARENTNOTIFY = 0x0210;
public static final int WM_PASTE = 0x302;
public static final int WM_PRINT = 0x0317;
public static final int WM_PRINTCLIENT = 0x0318;
public static final int WM_QUERYENDSESSION = 0x11;
- public static final int WM_QUERYNEWPALETTE = 0x30f;
public static final int WM_QUERYOPEN = 0x13;
public static final int WM_QUERYUISTATE = 0x129;
public static final int WM_RBUTTONDBLCLK = 0x206;
@@ -2521,8 +2516,6 @@ public static final native long /*int*/ CreateFontIndirect (LOGFONT lplf);
/** @param lplf flags=no_out */
public static final native long /*int*/ CreateIconIndirect (ICONINFO lplf);
public static final native long /*int*/ CreateMenu ();
-/** @param logPalette cast=(LOGPALETTE *),flags=no_out critical */
-public static final native long /*int*/ CreatePalette (byte[] logPalette);
/** @param hbmp cast=(HBITMAP) */
public static final native long /*int*/ CreatePatternBrush (long /*int*/ hbmp);
/** @param crColor cast=(COLORREF) */
@@ -2928,11 +2921,6 @@ public static final native long /*int*/ GetModuleHandle (char [] lpModuleName);
*/
public static final native boolean GetMonitorInfo (long /*int*/ hmonitor, MONITORINFO lpmi);
/**
- * @param hPal cast=(HPALETTE)
- * @param crColor cast=(COLORREF)
- */
-public static final native int GetNearestPaletteIndex (long /*int*/ hPal, int crColor);
-/**
* @param hgdiobj cast=(HGDIOBJ)
* @param lpvObject flags=no_in
*/
@@ -2961,11 +2949,6 @@ public static final native int GetObject (long /*int*/ hgdiobj, int cbBuffer, lo
public static final native boolean GetOpenFileName (OPENFILENAME lpofn);
/** @param hdc cast=(HDC) */
public static final native int GetOutlineTextMetrics (long /*int*/ hdc, int cbData, OUTLINETEXTMETRIC lpOTM);
-/**
- * @param hPalette cast=(HPALETTE)
- * @param logPalette cast=(LPPALETTEENTRY),flags=no_in critical
- */
-public static final native int GetPaletteEntries (long /*int*/ hPalette, int iStartIndex, int nEntries, byte[] logPalette);
/** @param hWnd cast=(HWND) */
public static final native long /*int*/ GetParent (long /*int*/ hWnd);
/** @param hdc cast=(HDC) */
@@ -3023,13 +3006,6 @@ public static final native short GetSystemDefaultUILanguage ();
/** @param hWnd cast=(HWND) */
public static final native long /*int*/ GetSystemMenu (long /*int*/ hWnd, boolean bRevert);
public static final native int GetSystemMetrics (int nIndex);
-/**
- * @param hdc cast=(HDC)
- * @param iStartIndex cast=(UINT)
- * @param nEntries cast=(UINT)
- * @param lppe cast=(LPPALETTEENTRY),flags=no_in critical
- */
-public static final native int GetSystemPaletteEntries (long /*int*/ hdc, int iStartIndex, int nEntries, byte[] lppe);
/** @param hDC cast=(HDC) */
public static final native int GetTextColor (long /*int*/ hDC);
/**
@@ -3887,8 +3863,6 @@ public static final native int PSPropertyKeyFromString (char[] pszString, PROPER
public static final native boolean PtInRect (RECT rect, POINT pt);
/** @param hrgn cast=(HRGN) */
public static final native boolean PtInRegion (long /*int*/ hrgn, int X, int Y);
-/** @param hDC cast=(HDC) */
-public static final native int RealizePalette (long /*int*/ hDC);
/** @param hdc cast=(HDC) */
public static final native boolean Rectangle (long /*int*/ hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
/**
@@ -4143,11 +4117,6 @@ public static final native int SelectClipRgn (long /*int*/ hdc, long /*int*/ hrg
* @param HGDIObj cast=(HGDIOBJ)
*/
public static final native long /*int*/ SelectObject (long /*int*/ hDC, long /*int*/ HGDIObj);
-/**
- * @param hDC cast=(HDC)
- * @param hpal cast=(HPALETTE)
- */
-public static final native long /*int*/ SelectPalette (long /*int*/ hDC, long /*int*/ hpal, boolean bForceBackground);
/** @param pInputs cast=(LPINPUT) */
public static final native int SendInput (int nInputs, long /*int*/ pInputs, int cbSize);
/**
@@ -4395,11 +4364,6 @@ public static final native boolean SetMenuItemInfo (long /*int*/ hMenu, int uIte
/** @param hdc cast=(HDC) */
public static final native int SetMetaRgn (long /*int*/ hdc);
/**
- * @param hPal cast=(HPALETTE)
- * @param lppe cast=(PALETTEENTRY *),flags=no_out critical
- */
-public static final native int SetPaletteEntries (long /*int*/ hPal, int iStart, int cEntries, byte[] lppe);
-/**
* @param hWndChild cast=(HWND)
* @param hWndNewParent cast=(HWND)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
index a84b95c2e8..1ea30e486b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
@@ -15,7 +15,6 @@ package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
-import org.eclipse.swt.internal.win32.*;
/**
* Instances of this class manage the operating system resources that
@@ -214,20 +213,6 @@ public Color(Device device, RGB rgb, int alpha) {
@Override
void destroy() {
- /*
- * If this is a palette-based device,
- * Decrease the reference count for this color.
- * If the reference count reaches 0, the slot may
- * be reused when another color is allocated.
- */
- long /*int*/ hPal = device.hPalette;
- if (hPal != 0) {
- int index = OS.GetNearestPaletteIndex(hPal, handle);
- int[] colorRefCount = device.colorRefCount;
- if (colorRefCount[index] > 0) {
- colorRefCount[index]--;
- }
- }
handle = -1;
}
@@ -371,44 +356,6 @@ void init(int red, int green, int blue, int alpha) {
}
handle = (red & 0xFF) | ((green & 0xFF) << 8) | ((blue & 0xFF) << 16);
this.alpha = alpha;
-
- /* If this is not a palette-based device, return */
- long /*int*/ hPal = device.hPalette;
- if (hPal == 0) return;
-
- int[] colorRefCount = device.colorRefCount;
- /* Add this color to the default palette now */
- /* First find out if the color already exists */
- int index = OS.GetNearestPaletteIndex(hPal, handle);
- /* See if the nearest color actually is the color */
- byte[] entry = new byte[4];
- OS.GetPaletteEntries(hPal, index, 1, entry);
- if ((entry[0] == (byte)red) && (entry[1] == (byte)green) &&
- (entry[2] == (byte)blue)) {
- /* Found the color. Increment the ref count and return */
- colorRefCount[index]++;
- return;
- }
- /* Didn't find the color, allocate it now. Find the first free entry */
- int i = 0;
- while (i < colorRefCount.length) {
- if (colorRefCount[i] == 0) {
- index = i;
- break;
- }
- i++;
- }
- if (i == colorRefCount.length) {
- /* No free entries, use the closest one */
- /* Remake the handle from the actual rgbs */
- handle = (entry[0] & 0xFF) | ((entry[1] & 0xFF) << 8) |
- ((entry[2] & 0xFF) << 16);
- } else {
- /* Found a free entry */
- entry = new byte[] { (byte)(red & 0xFF), (byte)(green & 0xFF), (byte)(blue & 0xFF), 0 };
- OS.SetPaletteEntries(hPal, index, 1, entry);
- }
- colorRefCount[index]++;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
index c20659002d..996434c0cd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
@@ -37,21 +37,6 @@ public abstract class Device implements Drawable {
Object [] objects;
Object trackingLock;
- /**
- * Palette
- * (Warning: This field is platform dependent)
- * <p>
- * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
- * public API. It is marked public only so that it can be shared
- * within the packages provided by SWT. It is not available on all
- * platforms and should never be accessed from application code.
- * </p>
- *
- * @noreference This field is not intended to be referenced by clients.
- */
- public long /*int*/ hPalette = 0;
- int [] colorRefCount;
-
/* System Font */
Font systemFont;
@@ -695,58 +680,6 @@ protected void init () {
OS.ScriptGetProperties (ppSp, piNumScripts);
scripts = new long /*int*/ [piNumScripts [0]];
OS.MoveMemory (scripts, ppSp [0], scripts.length * C.PTR_SIZEOF);
-
- /*
- * If we're not on a device which supports palettes,
- * don't create one.
- */
- long /*int*/ hDC = internal_new_GC (null);
- int rc = OS.GetDeviceCaps (hDC, OS.RASTERCAPS);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
-
- bits *= planes;
- if ((rc & OS.RC_PALETTE) == 0 || bits != 8) {
- internal_dispose_GC (hDC, null);
- return;
- }
-
- int numReserved = OS.GetDeviceCaps (hDC, OS.NUMRESERVED);
- int numEntries = OS.GetDeviceCaps (hDC, OS.SIZEPALETTE);
-
- /* Create the palette and reference counter */
- colorRefCount = new int [numEntries];
-
- /* 4 bytes header + 4 bytes per entry * numEntries entries */
- byte [] logPalette = new byte [4 + 4 * numEntries];
-
- /* 2 bytes = special header */
- logPalette [0] = 0x00;
- logPalette [1] = 0x03;
-
- /* 2 bytes = number of colors, LSB first */
- logPalette [2] = 0;
- logPalette [3] = 1;
-
- /*
- * Create a palette which contains the system entries
- * as they are located in the system palette. The
- * MSDN article 'Memory Device Contexts' describes
- * where system entries are located. On an 8 bit
- * display with 20 reserved colors, the system colors
- * will be the first 10 entries and the last 10 ones.
- */
- byte[] lppe = new byte [4 * numEntries];
- OS.GetSystemPaletteEntries (hDC, 0, numEntries, lppe);
- /* Copy all entries from the system palette */
- System.arraycopy (lppe, 0, logPalette, 4, 4 * numEntries);
- /* Lock the indices corresponding to the system entries */
- for (int i = 0; i < numReserved / 2; i++) {
- colorRefCount [i] = 1;
- colorRefCount [numEntries - 1 - i] = 1;
- }
- internal_dispose_GC (hDC, null);
- hPalette = OS.CreatePalette (logPalette);
}
/**
* Invokes platform specific functionality to allocate a new GC handle.
@@ -939,9 +872,6 @@ protected void release () {
}
gdipToken = null;
scripts = null;
- if (hPalette != 0) OS.DeleteObject (hPalette);
- hPalette = 0;
- colorRefCount = null;
logFonts = null;
nFonts = 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
index 240a90995c..3158b3d157 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
@@ -3851,11 +3851,6 @@ void init(Drawable drawable, GCData data, long /*int*/ hDC) {
} else {
data.font = Font.win32_new(device, OS.GetCurrentObject(hDC, OS.OBJ_FONT));
}
- long /*int*/ hPalette = data.device.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette(hDC, hPalette, true);
- OS.RealizePalette(hDC);
- }
Image image = data.image;
if (image != null) {
data.hNullBitmap = OS.SelectObject(hDC, image.handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
index f4bac26440..e8e2f61a12 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
@@ -1447,15 +1447,6 @@ public ImageData getImageDataAtCurrentZoom() {
/* Create the DC and select the bitmap */
long /*int*/ hBitmapDC = OS.CreateCompatibleDC(hDC);
long /*int*/ hOldBitmap = OS.SelectObject(hBitmapDC, hBitmap);
- /* Select the palette if necessary */
- long /*int*/ oldPalette = 0;
- if (depth <= 8) {
- long /*int*/ hPalette = device.hPalette;
- if (hPalette != 0) {
- oldPalette = OS.SelectPalette(hBitmapDC, hPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- }
/* Find the size of the image and allocate data */
int imageSize;
/* Call with null lpBits to get the image size */
@@ -1530,10 +1521,6 @@ public ImageData getImageDataAtCurrentZoom() {
}
/* Clean up */
OS.SelectObject(hBitmapDC, hOldBitmap);
- if (oldPalette != 0) {
- OS.SelectPalette(hBitmapDC, oldPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
OS.DeleteDC(hBitmapDC);
/* Release the HDC for the device */
@@ -1590,15 +1577,6 @@ public ImageData getImageDataAtCurrentZoom() {
/* Create the DC and select the bitmap */
long /*int*/ hBitmapDC = OS.CreateCompatibleDC(hDC);
long /*int*/ hOldBitmap = OS.SelectObject(hBitmapDC, handle);
- /* Select the palette if necessary */
- long /*int*/ oldPalette = 0;
- if (!isDib && depth <= 8) {
- long /*int*/ hPalette = device.hPalette;
- if (hPalette != 0) {
- oldPalette = OS.SelectPalette(hBitmapDC, hPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
- }
/* Find the size of the image and allocate data */
int imageSize;
if (isDib) {
@@ -1647,10 +1625,6 @@ public ImageData getImageDataAtCurrentZoom() {
}
/* Clean up */
OS.SelectObject(hBitmapDC, hOldBitmap);
- if (oldPalette != 0) {
- OS.SelectPalette(hBitmapDC, oldPalette, false);
- OS.RealizePalette(hBitmapDC);
- }
OS.DeleteDC(hBitmapDC);
/* Release the HDC for the device */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index c0ef868153..61cacd758f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -989,11 +989,6 @@ void enableWidget (boolean enabled) {
void fillBackground (long /*int*/ hDC, int pixel, RECT rect) {
if (rect.left > rect.right || rect.top > rect.bottom) return;
- long /*int*/ hPalette = display.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette (hDC, hPalette, false);
- OS.RealizePalette (hDC);
- }
OS.FillRect (hDC, rect, findBrush (pixel, OS.BS_SOLID));
}
@@ -4819,13 +4814,11 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
case OS.WM_NCPAINT: result = WM_NCPAINT (wParam, lParam); break;
case OS.WM_NOTIFY: result = WM_NOTIFY (wParam, lParam); break;
case OS.WM_PAINT: result = WM_PAINT (wParam, lParam); break;
- case OS.WM_PALETTECHANGED: result = WM_PALETTECHANGED (wParam, lParam); break;
case OS.WM_PARENTNOTIFY: result = WM_PARENTNOTIFY (wParam, lParam); break;
case OS.WM_PASTE: result = WM_PASTE (wParam, lParam); break;
case OS.WM_PRINT: result = WM_PRINT (wParam, lParam); break;
case OS.WM_PRINTCLIENT: result = WM_PRINTCLIENT (wParam, lParam); break;
case OS.WM_QUERYENDSESSION: result = WM_QUERYENDSESSION (wParam, lParam); break;
- case OS.WM_QUERYNEWPALETTE: result = WM_QUERYNEWPALETTE (wParam, lParam); break;
case OS.WM_QUERYOPEN: result = WM_QUERYOPEN (wParam, lParam); break;
case OS.WM_RBUTTONDBLCLK: result = WM_RBUTTONDBLCLK (wParam, lParam); break;
case OS.WM_RBUTTONDOWN: result = WM_RBUTTONDOWN (wParam, lParam); break;
@@ -4918,11 +4911,6 @@ LRESULT WM_CONTEXTMENU (long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT WM_CTLCOLOR (long /*int*/ wParam, long /*int*/ lParam) {
- long /*int*/ hPalette = display.hPalette;
- if (hPalette != 0) {
- OS.SelectPalette (wParam, hPalette, false);
- OS.RealizePalette (wParam);
- }
Control control = display.getControl (lParam);
if (control == null) return null;
return control.wmColorChild (wParam, lParam);
@@ -5368,10 +5356,6 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
return wmPaint (handle, wParam, lParam);
}
-LRESULT WM_PALETTECHANGED (long /*int*/ wParam, long /*int*/ lParam) {
- return null;
-}
-
LRESULT WM_PARENTNOTIFY (long /*int*/ wParam, long /*int*/ lParam) {
return null;
}
@@ -5392,10 +5376,6 @@ LRESULT WM_QUERYENDSESSION (long /*int*/ wParam, long /*int*/ lParam) {
return null;
}
-LRESULT WM_QUERYNEWPALETTE (long /*int*/ wParam, long /*int*/ lParam) {
- return null;
-}
-
LRESULT WM_QUERYOPEN (long /*int*/ wParam, long /*int*/ lParam) {
return null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
index 4d5c2d3294..75f472fbeb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
@@ -1435,20 +1435,6 @@ void reskinChildren (int flags) {
super.reskinChildren (flags);
}
-LRESULT selectPalette (long /*int*/ hPalette) {
- long /*int*/ hDC = OS.GetDC (handle);
- long /*int*/ hOld = OS.SelectPalette (hDC, hPalette, false);
- int result = OS.RealizePalette (hDC);
- if (result > 0) {
- OS.InvalidateRect (handle, null, true);
- } else {
- OS.SelectPalette (hDC, hOld, true);
- OS.RealizePalette (hDC);
- }
- OS.ReleaseDC (handle, hDC);
- return (result > 0) ? LRESULT.ONE : LRESULT.ZERO;
-}
-
@Override
boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lParam, Event event) {
if (!isEnabled () || !isActive ()) return false;
@@ -2390,22 +2376,6 @@ LRESULT WM_NCLBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_PALETTECHANGED (long /*int*/ wParam, long /*int*/ lParam) {
- if (wParam != handle) {
- long /*int*/ hPalette = display.hPalette;
- if (hPalette != 0) return selectPalette (hPalette);
- }
- return super.WM_PALETTECHANGED (wParam, lParam);
-}
-
-@Override
-LRESULT WM_QUERYNEWPALETTE (long /*int*/ wParam, long /*int*/ lParam) {
- long /*int*/ hPalette = display.hPalette;
- if (hPalette != 0) return selectPalette (hPalette);
- return super.WM_QUERYNEWPALETTE (wParam, lParam);
-}
-
-@Override
LRESULT WM_SETCURSOR (long /*int*/ wParam, long /*int*/ lParam) {
/*
* Feature in Windows. When the shell is disabled

Back to the top