Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
0fee35b6
Commit
0fee35b6
authored
1 year ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Add initial icon settings.
Also, set both _NET_WM_ICON and WMHint icon pixmap
parent
2b8b2b03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/conio/ciolib.c
+2
-0
2 additions, 0 deletions
src/conio/ciolib.c
src/conio/ciolib.h
+2
-0
2 additions, 0 deletions
src/conio/ciolib.h
src/conio/x_events.c
+82
-69
82 additions, 69 deletions
src/conio/x_events.c
src/syncterm/syncterm.c
+2
-0
2 additions, 0 deletions
src/syncterm/syncterm.c
with
88 additions
and
69 deletions
src/conio/ciolib.c
+
2
−
0
View file @
0fee35b6
...
...
@@ -90,6 +90,8 @@ CIOLIBEXPORT int ciolib_initial_window_width = -1;
CIOLIBEXPORT
double
ciolib_initial_scaling
=
0
;
CIOLIBEXPORT
int
ciolib_initial_mode
=
C80
;
CIOLIBEXPORT
enum
ciolib_scaling
ciolib_initial_scaling_type
=
CIOLIB_SCALING_INTERNAL
;
CIOLIBEXPORT
const
void
*
ciolib_initial_icon
=
syncicon64
;
CIOLIBEXPORT
size_t
ciolib_initial_icon_width
=
64
;
CIOLIBEXPORT
const
uint32_t
*
ciolib_r2yptr
;
CIOLIBEXPORT
const
uint32_t
*
ciolib_y2rptr
;
...
...
This diff is collapsed.
Click to expand it.
src/conio/ciolib.h
+
2
−
0
View file @
0fee35b6
...
...
@@ -417,6 +417,8 @@ CIOLIBEXPORTVAR int ciolib_initial_window_width;
CIOLIBEXPORTVAR
double
ciolib_initial_scaling
;
CIOLIBEXPORTVAR
int
ciolib_initial_mode
;
CIOLIBEXPORTVAR
enum
ciolib_scaling
ciolib_initial_scaling_type
;
CIOLIBEXPORTVAR
const
void
*
ciolib_initial_icon
;
CIOLIBEXPORTVAR
size_t
ciolib_initial_icon_width
;
CIOLIBEXPORTVAR
const
uint32_t
*
ciolib_r2yptr
;
CIOLIBEXPORTVAR
const
uint32_t
*
ciolib_y2rptr
;
...
...
This diff is collapsed.
Click to expand it.
src/conio/x_events.c
+
82
−
69
View file @
0fee35b6
...
...
@@ -408,6 +408,84 @@ static void map_window()
return
;
}
static
void
set_icon
(
const
void
*
data
,
size_t
width
,
XWMHints
*
hints
)
{
const
uint32_t
*
idata
=
data
;
Pixmap
opm
=
icn
;
Pixmap
opmm
=
icn_mask
;
XGCValues
gcv
=
{
.
function
=
GXcopy
,
.
foreground
=
black
|
0xff000000
,
.
background
=
white
};
int
x
,
y
,
i
;
GC
igc
,
imgc
;
bool
fail
=
false
;
unsigned
short
tmp
;
XColor
fg
;
bool
sethints
=
(
hints
!=
NULL
);
icn
=
x11
.
XCreatePixmap
(
dpy
,
DefaultRootWindow
(
dpy
),
width
,
width
,
depth
);
igc
=
x11
.
XCreateGC
(
dpy
,
icn
,
GCFunction
|
GCForeground
|
GCBackground
|
GCGraphicsExposures
,
&
gcv
);
icn_mask
=
x11
.
XCreatePixmap
(
dpy
,
DefaultRootWindow
(
dpy
),
width
,
width
,
1
);
imgc
=
x11
.
XCreateGC
(
dpy
,
icn_mask
,
GCFunction
|
GCForeground
|
GCBackground
|
GCGraphicsExposures
,
&
gcv
);
fail
=
(
!
icn
)
||
(
!
icn_mask
);
if
(
!
fail
)
{
for
(
x
=
0
,
i
=
0
;
x
<
width
;
x
++
)
{
for
(
y
=
0
;
y
<
width
;
y
++
)
{
if
(
idata
[
i
]
&
0xff000000
)
{
tmp
=
(
idata
[
i
]
&
0xff
);
fg
.
red
=
tmp
<<
8
|
tmp
;
tmp
=
(
idata
[
i
]
&
0xff00
)
>>
8
;
fg
.
green
=
tmp
<<
8
|
tmp
;
tmp
=
(
idata
[
i
]
&
0xff0000
)
>>
16
;
fg
.
blue
=
tmp
<<
8
|
tmp
;
fg
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
if
(
x11
.
XAllocColor
(
dpy
,
wincmap
,
&
fg
)
==
0
)
fail
=
true
;
else
{
x11
.
XSetForeground
(
dpy
,
igc
,
fg
.
pixel
);
x11
.
XDrawPoint
(
dpy
,
icn
,
igc
,
y
,
x
);
x11
.
XSetForeground
(
dpy
,
imgc
,
white
);
x11
.
XDrawPoint
(
dpy
,
icn_mask
,
imgc
,
y
,
x
);
}
if
(
fail
)
break
;
}
else
{
x11
.
XSetForeground
(
dpy
,
imgc
,
black
);
x11
.
XDrawPoint
(
dpy
,
icn_mask
,
imgc
,
y
,
x
);
}
i
++
;
}
if
(
fail
)
break
;
}
}
if
(
!
fail
)
{
if
(
!
hints
)
hints
=
x11
.
XGetWMHints
(
dpy
,
win
);
if
(
!
hints
)
hints
=
x11
.
XAllocWMHints
();
if
(
hints
)
{
hints
->
flags
|=
IconPixmapHint
|
IconMaskHint
;
hints
->
icon_pixmap
=
icn
;
hints
->
icon_mask
=
icn_mask
;
if
(
sethints
)
{
x11
.
XSetWMHints
(
dpy
,
win
,
hints
);
x11
.
XFree
(
hints
);
}
if
(
opm
)
x11
.
XFreePixmap
(
dpy
,
opm
);
if
(
opmm
)
x11
.
XFreePixmap
(
dpy
,
opmm
);
}
}
x11
.
XFreeGC
(
dpy
,
igc
);
x11
.
XFreeGC
(
dpy
,
imgc
);
}
/* Get a connection to the X server and create the window. */
static
int
init_window
()
{
...
...
@@ -479,10 +557,12 @@ static int init_window()
if
(
classhints
)
classhints
->
res_name
=
classhints
->
res_class
=
"CIOLIB"
;
wmhints
=
x11
.
XAllocWMHints
();
wmhints
->
flags
=
0
;
if
(
wmhints
)
{
wmhints
->
initial_state
=
NormalState
;
wmhints
->
flags
=
(
StateHint
/* | IconPixmapHint | IconMaskHint*/
|
InputHint
);
wmhints
->
flags
|
=
(
StateHint
|
InputHint
);
wmhints
->
input
=
True
;
set_icon
(
ciolib_initial_icon
,
ciolib_initial_icon_width
,
wmhints
);
x11
.
XSetWMProperties
(
dpy
,
win
,
NULL
,
NULL
,
0
,
0
,
NULL
,
wmhints
,
classhints
);
x11
.
XFree
(
wmhints
);
}
...
...
@@ -1537,82 +1617,15 @@ void x11_event_thread(void *args)
x11
.
XBell
(
dpy
,
100
);
break
;
case
X11_LOCAL_SETICON
:
{
#if 0
// This doesn't work on ChromeOS, presumably because XWayland sucks.
Atom
wmicon
=
x11
.
XInternAtom
(
dpy
,
"_NET_WM_ICON"
,
False
);
if
(
wmicon
)
{
x11
.
XChangeProperty
(
dpy
,
win
,
wmicon
,
XA_CARDINAL
,
32
,
PropModeReplace
,
(
unsigned
char
*
)
lev
.
data
.
icon_data
,
lev
.
data
.
icon_data
[
0
]
*
lev
.
data
.
icon_data
[
1
]
+
2
);
x11
.
XFlush
(
dpy
);
}
set_icon
(
&
lev
.
data
.
icon_data
[
2
],
lev
.
data
.
icon_data
[
0
],
NULL
);
free
(
lev
.
data
.
icon_data
);
break
;
#else
Pixmap
opm
=
icn
;
Pixmap
opmm
=
icn_mask
;
XGCValues
gcv
=
{
.
function
=
GXcopy
,
.
foreground
=
black
|
0xff000000
,
.
background
=
white
};
icn
=
x11
.
XCreatePixmap
(
dpy
,
DefaultRootWindow
(
dpy
),
lev
.
data
.
icon_data
[
0
],
lev
.
data
.
icon_data
[
1
],
depth
);
GC
igc
=
x11
.
XCreateGC
(
dpy
,
icn
,
GCFunction
|
GCForeground
|
GCBackground
|
GCGraphicsExposures
,
&
gcv
);
icn_mask
=
x11
.
XCreatePixmap
(
dpy
,
DefaultRootWindow
(
dpy
),
lev
.
data
.
icon_data
[
0
],
lev
.
data
.
icon_data
[
1
],
1
);
GC
imgc
=
x11
.
XCreateGC
(
dpy
,
icn_mask
,
GCFunction
|
GCForeground
|
GCBackground
|
GCGraphicsExposures
,
&
gcv
);
int
x
,
y
,
i
;
bool
fail
=
(
!
icn
)
||
(
!
icn_mask
);
if
(
!
fail
)
{
for
(
x
=
0
,
i
=
2
;
x
<
lev
.
data
.
icon_data
[
0
];
x
++
)
{
for
(
y
=
0
;
y
<
lev
.
data
.
icon_data
[
1
];
y
++
)
{
XColor
fg
=
{
0
};
unsigned
short
tmp
;
if
(
lev
.
data
.
icon_data
[
i
]
&
0xff000000
)
{
tmp
=
(
lev
.
data
.
icon_data
[
i
]
&
0xff0000
)
>>
16
;
fg
.
red
=
tmp
<<
8
|
tmp
;
tmp
=
(
lev
.
data
.
icon_data
[
i
]
&
0xff00
)
>>
8
;
fg
.
green
=
tmp
<<
8
|
tmp
;
tmp
=
(
lev
.
data
.
icon_data
[
i
]
&
0xff
);
fg
.
blue
=
tmp
<<
8
|
tmp
;
fg
.
flags
=
DoRed
|
DoGreen
|
DoBlue
;
if
(
x11
.
XAllocColor
(
dpy
,
wincmap
,
&
fg
)
==
0
)
fail
=
true
;
else
{
x11
.
XSetForeground
(
dpy
,
igc
,
fg
.
pixel
);
x11
.
XDrawPoint
(
dpy
,
icn
,
igc
,
y
,
x
);
x11
.
XSetForeground
(
dpy
,
imgc
,
white
);
x11
.
XDrawPoint
(
dpy
,
icn_mask
,
imgc
,
y
,
x
);
}
if
(
fail
)
break
;
}
else
{
x11
.
XSetForeground
(
dpy
,
imgc
,
black
);
x11
.
XDrawPoint
(
dpy
,
icn_mask
,
imgc
,
y
,
x
);
}
i
++
;
}
if
(
fail
)
break
;
}
}
if
(
!
fail
)
{
XWMHints
*
hints
=
x11
.
XGetWMHints
(
dpy
,
win
);
if
(
!
hints
)
hints
=
x11
.
XAllocWMHints
();
if
(
hints
)
{
hints
->
flags
|=
IconPixmapHint
|
IconMaskHint
;
hints
->
icon_pixmap
=
icn
;
hints
->
icon_mask
=
icn_mask
;
x11
.
XSetWMHints
(
dpy
,
win
,
hints
);
x11
.
XFree
(
hints
);
if
(
opm
)
x11
.
XFreePixmap
(
dpy
,
opm
);
if
(
opmm
)
x11
.
XFreePixmap
(
dpy
,
opmm
);
}
}
x11
.
XFreeGC
(
dpy
,
igc
);
x11
.
XFreeGC
(
dpy
,
imgc
);
#endif
}
case
X11_LOCAL_MOUSEPOINTER
:
{
unsigned
shape
=
UINT_MAX
;
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/syncterm.c
+
2
−
0
View file @
0fee35b6
...
...
@@ -1558,6 +1558,8 @@ main(int argc, char **argv)
vparams
[
cvmode
].
charheight
=
settings
.
custom_fontheight
;
vparams
[
cvmode
].
aspect_width
=
settings
.
custom_aw
;
vparams
[
cvmode
].
aspect_height
=
settings
.
custom_ah
;
ciolib_initial_icon
=
syncterm_icon
.
pixel_data
;
ciolib_initial_icon_width
=
syncterm_icon
.
width
;
ciolib_initial_scaling
=
settings
.
scaling_factor
;
ciolib_mode
=
settings
.
output_mode
;
if
(
settings
.
startup_mode
!=
SCREEN_MODE_CURRENT
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment