Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
5e7afb8c
Commit
5e7afb8c
authored
Nov 17, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Store the palette mapping in an X context instead of the GDI object.
parent
bb51f969
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
19 deletions
+41
-19
palette.c
dlls/winex11.drv/palette.c
+40
-19
winex11.drv.spec
dlls/winex11.drv/winex11.drv.spec
+1
-0
No files found.
dlls/winex11.drv/palette.c
View file @
5e7afb8c
...
@@ -20,11 +20,12 @@
...
@@ -20,11 +20,12 @@
#include "config.h"
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include "gdi.h"
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winreg.h"
#include "x11drv.h"
#include "x11drv.h"
#include "wine/debug.h"
#include "wine/debug.h"
...
@@ -48,6 +49,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(palette);
...
@@ -48,6 +49,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(palette);
* http://premium.microsoft.com/msdn/library/techart/f30/f34/f40/d4d/sa942.htm
* http://premium.microsoft.com/msdn/library/techart/f30/f34/f40/d4d/sa942.htm
*/
*/
#define NB_RESERVED_COLORS 20
/* number of fixed colors in system palette */
#define PC_SYS_USED 0x80
/* palentry is used (both system and logical) */
#define PC_SYS_USED 0x80
/* palentry is used (both system and logical) */
#define PC_SYS_RESERVED 0x40
/* system palentry is not to be mapped to */
#define PC_SYS_RESERVED 0x40
/* system palentry is not to be mapped to */
...
@@ -81,6 +84,8 @@ static int palette_size;
...
@@ -81,6 +84,8 @@ static int palette_size;
static
int
X11DRV_PALETTE_firstFree
=
0
;
static
int
X11DRV_PALETTE_firstFree
=
0
;
static
unsigned
char
X11DRV_PALETTE_freeList
[
256
];
static
unsigned
char
X11DRV_PALETTE_freeList
[
256
];
static
XContext
palette_context
;
/* X context to associate a color mapping to a palette */
/**********************************************************************/
/**********************************************************************/
/* Map an EGA index (0..15) to a pixel value in the system color space. */
/* Map an EGA index (0..15) to a pixel value in the system color space. */
...
@@ -114,14 +119,11 @@ static int X11DRV_PALETTE_LookupSystemXPixel(COLORREF col);
...
@@ -114,14 +119,11 @@ static int X11DRV_PALETTE_LookupSystemXPixel(COLORREF col);
*/
*/
static
int
*
palette_get_mapping
(
HPALETTE
hpal
)
static
int
*
palette_get_mapping
(
HPALETTE
hpal
)
{
{
int
*
mapping
=
NULL
;
int
*
mapping
;
PALETTEOBJ
*
ptr
;
if
((
ptr
=
GDI_GetObjPtr
(
hpal
,
PALETTE_MAGIC
)))
wine_tsx11_lock
();
{
if
(
XFindContext
(
gdi_display
,
(
XID
)
hpal
,
palette_context
,
(
char
**
)
&
mapping
))
mapping
=
NULL
;
mapping
=
ptr
->
mapping
;
wine_tsx11_unlock
();
GDI_ReleaseObj
(
hpal
);
}
return
mapping
;
return
mapping
;
}
}
...
@@ -129,18 +131,11 @@ static int *palette_get_mapping( HPALETTE hpal )
...
@@ -129,18 +131,11 @@ static int *palette_get_mapping( HPALETTE hpal )
/***********************************************************************
/***********************************************************************
* palette_set_mapping
* palette_set_mapping
*/
*/
static
int
*
palette_set_mapping
(
HPALETTE
hpal
,
int
*
mapping
)
static
void
palette_set_mapping
(
HPALETTE
hpal
,
int
*
mapping
)
{
{
int
*
old_mapping
=
NULL
;
wine_tsx11_lock
();
PALETTEOBJ
*
ptr
;
XSaveContext
(
gdi_display
,
(
XID
)
hpal
,
palette_context
,
(
char
*
)
mapping
);
wine_tsx11_unlock
();
if
((
ptr
=
GDI_GetObjPtr
(
hpal
,
PALETTE_MAGIC
)))
{
old_mapping
=
ptr
->
mapping
;
ptr
->
mapping
=
mapping
;
GDI_ReleaseObj
(
hpal
);
}
return
old_mapping
;
}
}
...
@@ -153,10 +148,14 @@ int X11DRV_PALETTE_Init(void)
...
@@ -153,10 +148,14 @@ int X11DRV_PALETTE_Init(void)
{
{
int
mask
,
white
,
black
;
int
mask
,
white
,
black
;
int
monoPlane
;
int
monoPlane
;
int
*
mapping
;
PALETTEENTRY
sys_pal_template
[
NB_RESERVED_COLORS
];
PALETTEENTRY
sys_pal_template
[
NB_RESERVED_COLORS
];
TRACE
(
"initializing palette manager...
\n
"
);
TRACE
(
"initializing palette manager...
\n
"
);
wine_tsx11_lock
();
palette_context
=
XUniqueContext
();
wine_tsx11_unlock
();
white
=
WhitePixel
(
gdi_display
,
DefaultScreen
(
gdi_display
)
);
white
=
WhitePixel
(
gdi_display
,
DefaultScreen
(
gdi_display
)
);
black
=
BlackPixel
(
gdi_display
,
DefaultScreen
(
gdi_display
)
);
black
=
BlackPixel
(
gdi_display
,
DefaultScreen
(
gdi_display
)
);
monoPlane
=
1
;
monoPlane
=
1
;
...
@@ -244,6 +243,9 @@ int X11DRV_PALETTE_Init(void)
...
@@ -244,6 +243,9 @@ int X11DRV_PALETTE_Init(void)
GetPaletteEntries
(
GetStockObject
(
DEFAULT_PALETTE
),
0
,
NB_RESERVED_COLORS
,
sys_pal_template
);
GetPaletteEntries
(
GetStockObject
(
DEFAULT_PALETTE
),
0
,
NB_RESERVED_COLORS
,
sys_pal_template
);
if
((
mapping
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
int
)
*
NB_RESERVED_COLORS
)))
palette_set_mapping
(
GetStockObject
(
DEFAULT_PALETTE
),
mapping
);
if
(
X11DRV_PALETTE_PaletteFlags
&
X11DRV_PALETTE_VIRTUAL
)
if
(
X11DRV_PALETTE_PaletteFlags
&
X11DRV_PALETTE_VIRTUAL
)
{
{
palette_size
=
0
;
palette_size
=
0
;
...
@@ -1195,6 +1197,25 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
...
@@ -1195,6 +1197,25 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
return
iRemapped
;
return
iRemapped
;
}
}
/***********************************************************************
* UnrealizePalette (X11DRV.@)
*/
BOOL
X11DRV_UnrealizePalette
(
HPALETTE
hpal
)
{
int
*
mapping
=
palette_get_mapping
(
hpal
);
if
(
mapping
)
{
wine_tsx11_lock
();
XDeleteContext
(
gdi_display
,
(
XID
)
hpal
,
palette_context
);
wine_tsx11_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
mapping
);
}
return
TRUE
;
}
/***********************************************************************
/***********************************************************************
* GetSystemPaletteEntries (X11DRV.@)
* GetSystemPaletteEntries (X11DRV.@)
*/
*/
...
...
dlls/winex11.drv/winex11.drv.spec
View file @
5e7afb8c
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
@ cdecl SetTextColor(ptr long) X11DRV_SetTextColor
@ cdecl SetTextColor(ptr long) X11DRV_SetTextColor
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) X11DRV_StretchBlt
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) X11DRV_StretchBlt
@ cdecl SwapBuffers(ptr) X11DRV_SwapBuffers
@ cdecl SwapBuffers(ptr) X11DRV_SwapBuffers
@ cdecl UnrealizePalette(long) X11DRV_UnrealizePalette
# USER driver
# USER driver
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment