3 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include <libx/base.h>
26 #include <libx/object.h>
27 #include <libx/image.h>
28 #include <libx/cursor.h>
29 #include <libx/text.h>
41 int appsrv_accept (int fd
)
43 ipc_send (fd
, "ZDE", 3);
48 int appsrv_redraw (zde_dobj_appcl_t
*appcl
)
53 /* new window (client) */
54 if (appcl
->fd
== -1 && appcl_fd
!= -1) {
59 if (appcl
->fd
> 0 && !(appcl
->state
& APPCL_STATE_REDRAW
)) {
60 appcl
->state
|= APPCL_STATE_REDRAW
;
64 ipc_send (appcl
->fd
, (char *) appcl
, sizeof (appcl_t
));
66 int ret
= ipc_recv (appcl
->fd
, (char *) appsrv_buf
, 99);
69 memcpy (appcl
, appsrv_buf
, sizeof (appcl_t
));
71 if (appcl
->state
& APPCL_STATE_RECVOK
) {
72 appcl
->state
&= ~APPCL_STATE_RECVOK
;
83 int appsrv_exit (zde_dobj_appcl_t
*appcl
)
88 /* new window (client) ? */
92 appcl
->state
|= APPCL_STATE_EXIT
;
94 ipc_send (appcl
->fd
, (char *) appcl
, sizeof (appcl_t
));
99 void *handler_appsrv (void *p
)
101 for (;; schedule ()) {
102 int fd
= ipc_accept (appsrv_fd
);
115 appsrv_fd
= ipc_create ("/zdeserver", 0);
124 pthread_create (&thread
, NULL
, handler_appsrv
, 0);