Using libDesktop to send client messages
This commit is contained in:
parent
c863e42285
commit
2de4f6ac1d
11
src/Makefile
11
src/Makefile
@ -6,8 +6,9 @@ BINDIR = $(PREFIX)/bin
|
|||||||
CC ?= cc
|
CC ?= cc
|
||||||
CPPFLAGSF= -I ../include
|
CPPFLAGSF= -I ../include
|
||||||
CPPFLAGS=
|
CPPFLAGS=
|
||||||
CFLAGSF = -W
|
CFLAGSF = -W `pkg-config --cflags libSystem gtk+-2.0 libDesktop`
|
||||||
CFLAGS = -Wall -g -O2 -pedantic
|
CFLAGS = -Wall -g -O2 -pedantic
|
||||||
|
LDFLAGSF= `pkg-config --libs libSystem gtk+-2.0 libDesktop`
|
||||||
RM ?= rm -f
|
RM ?= rm -f
|
||||||
LN ?= ln -f
|
LN ?= ln -f
|
||||||
MKDIR ?= mkdir -p
|
MKDIR ?= mkdir -p
|
||||||
@ -20,15 +21,15 @@ subdirs:
|
|||||||
@for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done
|
@for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done
|
||||||
|
|
||||||
phone_OBJS = callbacks.o main.o modem.o phone.o
|
phone_OBJS = callbacks.o main.o modem.o phone.o
|
||||||
phone_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags libSystem libDesktop`
|
phone_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||||
phone_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs libSystem libDesktop`
|
phone_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||||
|
|
||||||
phone: $(phone_OBJS)
|
phone: $(phone_OBJS)
|
||||||
$(CC) -o phone $(phone_OBJS) $(phone_LDFLAGS)
|
$(CC) -o phone $(phone_OBJS) $(phone_LDFLAGS)
|
||||||
|
|
||||||
phonectl_OBJS = phonectl.o
|
phonectl_OBJS = phonectl.o
|
||||||
phonectl_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags gtk+-2.0`
|
phonectl_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||||
phonectl_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs gtk+-2.0`
|
phonectl_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||||
|
|
||||||
phonectl: $(phonectl_OBJS)
|
phonectl: $(phonectl_OBJS)
|
||||||
$(CC) -o phonectl $(phonectl_OBJS) $(phonectl_LDFLAGS)
|
$(CC) -o phonectl $(phonectl_OBJS) $(phonectl_LDFLAGS)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <Desktop.h>
|
||||||
#include "phone.h"
|
#include "phone.h"
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#define _(string) gettext(string)
|
#define _(string) gettext(string)
|
||||||
@ -67,8 +68,6 @@ int main(int argc, char * argv[])
|
|||||||
int o;
|
int o;
|
||||||
int type = PHONE_MESSAGE_SHOW;
|
int type = PHONE_MESSAGE_SHOW;
|
||||||
int action = -1;
|
int action = -1;
|
||||||
GdkEvent event;
|
|
||||||
GdkEventClient * client = &event.client;
|
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
@ -124,15 +123,6 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
if(action < 0)
|
if(action < 0)
|
||||||
return _usage();
|
return _usage();
|
||||||
memset(&event, 0, sizeof(event));
|
desktop_message_send(PHONE_CLIENT_MESSAGE, type, action, TRUE);
|
||||||
client->type = GDK_CLIENT_EVENT;
|
|
||||||
client->window = NULL;
|
|
||||||
client->send_event = TRUE;
|
|
||||||
client->message_type = gdk_atom_intern(PHONE_CLIENT_MESSAGE, FALSE);
|
|
||||||
client->data_format = 8;
|
|
||||||
client->data.b[0] = type;
|
|
||||||
client->data.b[1] = action;
|
|
||||||
client->data.b[2] = TRUE;
|
|
||||||
gdk_event_send_clientmessage_toall(&event);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,18 @@ subdirs=modems,plugins
|
|||||||
targets=phone,phonectl
|
targets=phone,phonectl
|
||||||
cppflags_force=-I ../include
|
cppflags_force=-I ../include
|
||||||
cppflags=
|
cppflags=
|
||||||
cflags_force=-W
|
cflags_force=-W `pkg-config --cflags libSystem gtk+-2.0 libDesktop`
|
||||||
cflags=-Wall -g -O2 -pedantic
|
cflags=-Wall -g -O2 -pedantic
|
||||||
|
ldflags_force=`pkg-config --libs libSystem gtk+-2.0 libDesktop`
|
||||||
dist=Makefile,callbacks.h,modem.h,phone.h
|
dist=Makefile,callbacks.h,modem.h,phone.h
|
||||||
|
|
||||||
[phone]
|
[phone]
|
||||||
type=binary
|
type=binary
|
||||||
cflags=`pkg-config --cflags libSystem libDesktop`
|
|
||||||
ldflags=`pkg-config --libs libSystem libDesktop`
|
|
||||||
sources=callbacks.c,main.c,modem.c,phone.c
|
sources=callbacks.c,main.c,modem.c,phone.c
|
||||||
install=$(BINDIR)
|
install=$(BINDIR)
|
||||||
|
|
||||||
[phonectl]
|
[phonectl]
|
||||||
type=binary
|
type=binary
|
||||||
cflags=`pkg-config --cflags gtk+-2.0`
|
|
||||||
ldflags=`pkg-config --libs gtk+-2.0`
|
|
||||||
sources=phonectl.c
|
sources=phonectl.c
|
||||||
install=$(BINDIR)
|
install=$(BINDIR)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user