Skip to content

Commit 5b5c0d2

Browse files
committed
try fix window min, ssl alert
1 parent fc24b9d commit 5b5c0d2

3 files changed

Lines changed: 73 additions & 3 deletions

File tree

orcaslicer/Dockerfile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1+
# Build Xmin
2+
FROM ubuntu:24.04 AS Xmin
3+
4+
# Install deps
5+
RUN \
6+
apt-get update && \
7+
DEBIAN_FRONTEND=noninteractive \
8+
apt-get install --no-install-recommends -y \
9+
build-essential libx11-dev libgtk-3-dev
10+
11+
# Build Xmin
12+
COPY Xmin.c /Xmin.c
13+
RUN gcc -shared -fPIC -o /libXmin.so /Xmin.c -ldl -lX11
14+
115
# Pull the baseimage
216
FROM jlesage/baseimage-gui:ubuntu-24.04-v4.10.6
317

4-
# Install orcaslicer
18+
# Install orcaslicer
519
RUN \
620
echo "**** install packages ****" && \
721
apt-get update && \
822
DEBIAN_FRONTEND=noninteractive \
923
apt-get install --no-install-recommends -y \
1024
curl \
11-
firefox \
1225
locales-all \
26+
ca-certificates \
1327
gstreamer1.0-alsa \
1428
gstreamer1.0-gl \
1529
gstreamer1.0-gtk3 \
@@ -49,8 +63,10 @@ RUN \
4963
/var/tmp/* \
5064
/tmp/*
5165

52-
# Copy the start script
66+
# App run stuff
67+
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
5368
COPY startapp.sh /startapp.sh
69+
COPY --from=Xmin /libXmin.so /libXmin.so
5470

5571
# Set the application name
5672
RUN set-cont-env APP_NAME "OrcaSlicer"

orcaslicer/Xmin.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#define _GNU_SOURCE
2+
#include <X11/Xatom.h>
3+
#include <X11/Xlib.h>
4+
#include <X11/Xutil.h>
5+
#include <dlfcn.h>
6+
#include <stdio.h>
7+
#include <string.h>
8+
9+
Status XIconifyWindow(Display* display, Window w, int screen_number) {
10+
return 1;
11+
}
12+
13+
Status XSendEvent(Display* display, Window w, Bool propagate, long event_mask,
14+
XEvent* event_send) {
15+
static Status (*orig_XSendEvent)(Display*, Window, Bool, long, XEvent*) =
16+
NULL;
17+
if (!orig_XSendEvent) orig_XSendEvent = dlsym(RTLD_NEXT, "XSendEvent");
18+
19+
if (event_send->type == ClientMessage) {
20+
Atom msg_type = event_send->xclient.message_type;
21+
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", False);
22+
23+
if (msg_type == wm_state) {
24+
long action = event_send->xclient.data.l[0];
25+
Atom prop = (Atom)event_send->xclient.data.l[1];
26+
Atom hidden = XInternAtom(display, "_NET_WM_STATE_HIDDEN", False);
27+
28+
if (prop == hidden) {
29+
return 1;
30+
}
31+
}
32+
}
33+
return orig_XSendEvent(display, w, propagate, event_mask, event_send);
34+
}
35+
36+
int XChangeProperty(Display* display, Window w, Atom property, Atom type,
37+
int format, int mode, const unsigned char* data,
38+
int nelements) {
39+
static int (*orig_XChangeProperty)(Display*, Window, Atom, Atom, int, int,
40+
const unsigned char*, int) = NULL;
41+
if (!orig_XChangeProperty)
42+
orig_XChangeProperty = dlsym(RTLD_NEXT, "XChangeProperty");
43+
44+
Atom wm_hints = XInternAtom(display, "WM_HINTS", False);
45+
if (property == wm_hints && data) {
46+
XWMHints* hints = (XWMHints*)data;
47+
if (hints->flags & StateHint && hints->initial_state == IconicState) {
48+
hints->initial_state = NormalState;
49+
}
50+
}
51+
return orig_XChangeProperty(display, w, property, type, format, mode, data,
52+
nelements);
53+
}

orcaslicer/startapp.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/sh
2+
export LD_PRELOAD=/libXmin.so
23
exec /opt/orcaslicer/AppRun

0 commit comments

Comments
 (0)