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
3c57f113
Commit
3c57f113
authored
Sep 26, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Create a default colormap along with the default visual info.
parent
988f2fde
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
31 deletions
+23
-31
palette.c
dlls/winex11.drv/palette.c
+18
-29
window.c
dlls/winex11.drv/window.c
+1
-1
x11drv.h
dlls/winex11.drv/x11drv.h
+1
-1
x11drv_main.c
dlls/winex11.drv/x11drv_main.c
+3
-0
No files found.
dlls/winex11.drv/palette.c
View file @
3c57f113
...
...
@@ -56,7 +56,6 @@ static int COLOR_gapStart = 256;
static
int
COLOR_gapEnd
=
-
1
;
static
int
COLOR_gapFilled
=
0
;
Colormap
X11DRV_PALETTE_PaletteXColormap
=
0
;
UINT16
X11DRV_PALETTE_PaletteFlags
=
0
;
/* initialize to zero to handle abortive X11DRV_PALETTE_VIRTUAL visuals */
...
...
@@ -161,9 +160,10 @@ int X11DRV_PALETTE_Init(void)
{
XSetWindowAttributes
win_attr
;
X11DRV_PALETTE_PaletteXColormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocAll
);
if
(
X11DRV_PALETTE_PaletteXColormap
)
XFreeColormap
(
gdi_display
,
default_colormap
);
default_colormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocAll
);
if
(
default_colormap
)
{
X11DRV_PALETTE_PaletteFlags
|=
(
X11DRV_PALETTE_PRIVATE
|
X11DRV_PALETTE_WHITESET
);
...
...
@@ -173,19 +173,14 @@ int X11DRV_PALETTE_Init(void)
if
(
root_window
!=
DefaultRootWindow
(
gdi_display
)
)
{
win_attr
.
colormap
=
X11DRV_PALETTE_PaletteXC
olormap
;
win_attr
.
colormap
=
default_c
olormap
;
XChangeWindowAttributes
(
gdi_display
,
root_window
,
CWColormap
,
&
win_attr
);
}
}
}
else
{
X11DRV_PALETTE_PaletteXColormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocNone
);
}
break
;
case
StaticGray
:
X11DRV_PALETTE_PaletteXColormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocNone
);
X11DRV_PALETTE_PaletteFlags
|=
X11DRV_PALETTE_FIXED
;
X11DRV_PALETTE_Graymax
=
(
1
<<
default_visual
.
depth
)
-
1
;
break
;
...
...
@@ -203,13 +198,9 @@ int X11DRV_PALETTE_Init(void)
for
(
white
=
palette_size
-
1
;
!
(
white
&
1
);
white
>>=
1
)
monoPlane
++
;
X11DRV_PALETTE_PaletteFlags
=
(
white
&
mask
)
?
X11DRV_PALETTE_WHITESET
:
0
;
X11DRV_PALETTE_PaletteXColormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocNone
);
}
else
{
X11DRV_PALETTE_PaletteXColormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocNone
);
X11DRV_PALETTE_PaletteFlags
|=
X11DRV_PALETTE_FIXED
;
X11DRV_PALETTE_ComputeColorShifts
(
&
X11DRV_PALETTE_default_shifts
,
default_visual
.
red_mask
,
default_visual
.
green_mask
,
default_visual
.
blue_mask
);
}
...
...
@@ -218,8 +209,6 @@ int X11DRV_PALETTE_Init(void)
}
}
TRACE
(
" visual class %i (%i)
\n
"
,
default_visual
.
class
,
monoPlane
);
GetPaletteEntries
(
GetStockObject
(
DEFAULT_PALETTE
),
0
,
NB_RESERVED_COLORS
,
sys_pal_template
);
if
(
X11DRV_PALETTE_PaletteFlags
&
X11DRV_PALETTE_VIRTUAL
)
...
...
@@ -349,7 +338,7 @@ static BOOL X11DRV_PALETTE_BuildPrivateMap( const PALETTEENTRY *sys_pal_template
color
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
color
.
pixel
=
i
;
XStoreColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
color
);
XStoreColor
(
gdi_display
,
default_c
olormap
,
&
color
);
/* Set EGA mapping if color is from the first or last eight */
...
...
@@ -396,7 +385,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
defaultColors
[
i
].
pixel
=
(
long
)
i
;
XQueryColors
(
gdi_display
,
defaultCM
,
&
defaultColors
[
0
],
copy_default_colors
);
for
(
i
=
0
;
i
<
copy_default_colors
;
i
++
)
XAllocColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
defaultColors
[
i
]
);
XAllocColor
(
gdi_display
,
default_c
olormap
,
&
defaultColors
[
i
]
);
if
(
alloc_system_colors
>
256
)
alloc_system_colors
=
256
;
else
if
(
alloc_system_colors
<
20
)
alloc_system_colors
=
20
;
...
...
@@ -413,7 +402,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
color
.
blue
=
sys_pal_template
[
i
].
peBlue
*
65535
/
255
;
color
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
if
(
!
XAllocColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
color
))
if
(
!
XAllocColor
(
gdi_display
,
default_c
olormap
,
&
color
))
{
XColor
best
,
c
;
...
...
@@ -442,7 +431,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
best
.
pixel
=
best
.
red
=
best
.
green
=
best
.
blue
=
0
;
for
(
c
.
pixel
=
0
,
diff
=
0x7fffffff
;
c
.
pixel
<
max
;
c
.
pixel
+=
step
)
{
XQueryColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
c
);
XQueryColor
(
gdi_display
,
default_c
olormap
,
&
c
);
r
=
(
c
.
red
-
color
.
red
)
>>
8
;
g
=
(
c
.
green
-
color
.
green
)
>>
8
;
b
=
(
c
.
blue
-
color
.
blue
)
>>
8
;
...
...
@@ -450,7 +439,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
if
(
r
<
diff
)
{
best
=
c
;
diff
=
r
;
}
}
if
(
XAllocColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
best
)
)
if
(
XAllocColor
(
gdi_display
,
default_c
olormap
,
&
best
)
)
color
.
pixel
=
best
.
pixel
;
else
color
.
pixel
=
(
i
<
NB_RESERVED_COLORS
/
2
)
?
bp
:
wp
;
}
...
...
@@ -492,12 +481,12 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
{
c_val
=
(
c_max
+
c_min
)
/
2
+
(
c_max
+
c_min
)
%
2
;
if
(
!
XAllocColorCells
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
False
,
if
(
!
XAllocColorCells
(
gdi_display
,
default_c
olormap
,
False
,
plane_masks
,
0
,
pixDynMapping
,
c_val
)
)
c_max
=
c_val
-
1
;
else
{
XFreeColors
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
pixDynMapping
,
c_val
,
0
);
XFreeColors
(
gdi_display
,
default_c
olormap
,
pixDynMapping
,
c_val
,
0
);
c_min
=
c_val
;
}
}
...
...
@@ -508,7 +497,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
c_min
=
(
c_min
/
2
)
+
(
c_min
/
2
);
/* need even set for split palette */
if
(
c_min
>
0
)
if
(
!
XAllocColorCells
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
False
,
if
(
!
XAllocColorCells
(
gdi_display
,
default_c
olormap
,
False
,
plane_masks
,
0
,
pixDynMapping
,
c_min
)
)
{
WARN
(
"Inexplicable failure during colorcell allocation.
\n
"
);
...
...
@@ -674,7 +663,7 @@ static void X11DRV_PALETTE_FillDefaultColors( const PALETTEENTRY *sys_pal_templa
color
.
green
=
COLOR_sysPal
[
idx
].
peGreen
<<
8
;
color
.
blue
=
COLOR_sysPal
[
idx
].
peBlue
<<
8
;
color
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
XStoreColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
color
);
XStoreColor
(
gdi_display
,
default_c
olormap
,
&
color
);
}
idx
=
X11DRV_PALETTE_freeList
[
idx
];
}
...
...
@@ -694,11 +683,11 @@ static void X11DRV_PALETTE_FillDefaultColors( const PALETTEENTRY *sys_pal_templa
{
xc
.
pixel
=
i
;
XQueryColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
xc
);
XQueryColor
(
gdi_display
,
default_c
olormap
,
&
xc
);
r
=
xc
.
red
>>
8
;
g
=
xc
.
green
>>
8
;
b
=
xc
.
blue
>>
8
;
if
(
xc
.
pixel
<
256
&&
X11DRV_PALETTE_CheckSysColor
(
sys_pal_template
,
RGB
(
r
,
g
,
b
))
&&
XAllocColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
xc
)
)
XAllocColor
(
gdi_display
,
default_c
olormap
,
&
xc
)
)
{
X11DRV_PALETTE_XPixelToPalette
[
xc
.
pixel
]
=
idx
;
X11DRV_PALETTE_PaletteToXPixel
[
idx
]
=
xc
.
pixel
;
...
...
@@ -796,7 +785,7 @@ COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
}
color
.
pixel
=
pixel
;
XQueryColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
color
);
XQueryColor
(
gdi_display
,
default_c
olormap
,
&
color
);
return
RGB
(
color
.
red
>>
8
,
color
.
green
>>
8
,
color
.
blue
>>
8
);
}
...
...
@@ -1210,7 +1199,7 @@ UINT X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary )
color
.
green
=
entries
[
i
].
peGreen
<<
8
;
color
.
blue
=
entries
[
i
].
peBlue
<<
8
;
color
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
XStoreColor
(
gdi_display
,
X11DRV_PALETTE_PaletteXC
olormap
,
&
color
);
XStoreColor
(
gdi_display
,
default_c
olormap
,
&
color
);
COLOR_sysPal
[
index
]
=
entries
[
i
];
COLOR_sysPal
[
index
].
peFlags
=
flag
;
...
...
dlls/winex11.drv/window.c
View file @
3c57f113
...
...
@@ -311,7 +311,7 @@ static void get_x11_rect_offset( struct x11drv_win_data *data, RECT *rect )
static
int
get_window_attributes
(
struct
x11drv_win_data
*
data
,
XSetWindowAttributes
*
attr
)
{
attr
->
override_redirect
=
!
data
->
managed
;
attr
->
colormap
=
X11DRV_PALETTE_PaletteXC
olormap
;
attr
->
colormap
=
default_c
olormap
;
attr
->
save_under
=
((
GetClassLongW
(
data
->
hwnd
,
GCL_STYLE
)
&
CS_SAVEBITS
)
!=
0
);
attr
->
bit_gravity
=
NorthWestGravity
;
attr
->
win_gravity
=
StaticGravity
;
...
...
dlls/winex11.drv/x11drv.h
View file @
3c57f113
...
...
@@ -245,7 +245,6 @@ extern Display *gdi_display DECLSPEC_HIDDEN; /* display to use for all GDI func
#define X11DRV_PALETTE_PRIVATE 0x1000
/* private colormap, identity mapping */
#define X11DRV_PALETTE_WHITESET 0x2000
extern
Colormap
X11DRV_PALETTE_PaletteXColormap
DECLSPEC_HIDDEN
;
extern
UINT16
X11DRV_PALETTE_PaletteFlags
DECLSPEC_HIDDEN
;
extern
int
*
X11DRV_PALETTE_PaletteToXPixel
DECLSPEC_HIDDEN
;
...
...
@@ -348,6 +347,7 @@ static inline size_t get_property_size( int format, unsigned long count )
}
extern
XVisualInfo
default_visual
DECLSPEC_HIDDEN
;
extern
Colormap
default_colormap
DECLSPEC_HIDDEN
;
extern
XPixmapFormatValues
**
pixmap_formats
DECLSPEC_HIDDEN
;
extern
Window
root_window
DECLSPEC_HIDDEN
;
extern
int
clipping_cursor
DECLSPEC_HIDDEN
;
...
...
dlls/winex11.drv/x11drv_main.c
View file @
3c57f113
...
...
@@ -57,6 +57,7 @@ WINE_DECLARE_DEBUG_CHANNEL(synchronous);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
XVisualInfo
default_visual
=
{
0
};
Colormap
default_colormap
=
None
;
XPixmapFormatValues
**
pixmap_formats
;
unsigned
int
screen_width
;
unsigned
int
screen_height
;
...
...
@@ -509,6 +510,8 @@ static void init_visuals( Display *display, int screen )
default_visual
.
colormap_size
=
default_visual
.
visual
->
map_entries
;
default_visual
.
bits_per_rgb
=
default_visual
.
visual
->
bits_per_rgb
;
}
default_colormap
=
XCreateColormap
(
gdi_display
,
root_window
,
default_visual
.
visual
,
AllocNone
);
TRACE
(
"default visual %lx class %u
\n
"
,
default_visual
.
visualid
,
default_visual
.
class
);
}
/***********************************************************************
...
...
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