diff --git a/Makefile b/Makefile index fecf448..2ea125e 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ dist: $(PACKAGE)-$(VERSION)/include/Desktop/assistant.h \ $(PACKAGE)-$(VERSION)/include/Desktop/compat.h \ $(PACKAGE)-$(VERSION)/include/Desktop/menubar.h \ + $(PACKAGE)-$(VERSION)/include/Desktop/message.h \ $(PACKAGE)-$(VERSION)/include/Desktop/mime.h \ $(PACKAGE)-$(VERSION)/include/Desktop/toolbar.h \ $(PACKAGE)-$(VERSION)/include/Desktop/Makefile \ @@ -41,6 +42,7 @@ dist: $(PACKAGE)-$(VERSION)/src/accel.c \ $(PACKAGE)-$(VERSION)/src/assistant.c \ $(PACKAGE)-$(VERSION)/src/menubar.c \ + $(PACKAGE)-$(VERSION)/src/message.c \ $(PACKAGE)-$(VERSION)/src/mime.c \ $(PACKAGE)-$(VERSION)/src/toolbar.c \ $(PACKAGE)-$(VERSION)/src/Makefile \ diff --git a/include/Desktop.h b/include/Desktop.h index df389d3..b049a66 100644 --- a/include/Desktop.h +++ b/include/Desktop.h @@ -26,6 +26,7 @@ # include "Desktop/assistant.h" # include "Desktop/compat.h" # include "Desktop/menubar.h" +# include "Desktop/message.h" # include "Desktop/mime.h" # include "Desktop/toolbar.h" diff --git a/include/Desktop/Makefile b/include/Desktop/Makefile index fa64f5b..33ee33d 100644 --- a/include/Desktop/Makefile +++ b/include/Desktop/Makefile @@ -25,6 +25,8 @@ install: $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop $(INSTALL) -m 0644 -- menubar.h $(DESTDIR)$(PREFIX)/include/Desktop/menubar.h $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop + $(INSTALL) -m 0644 -- message.h $(DESTDIR)$(PREFIX)/include/Desktop/message.h + $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop $(INSTALL) -m 0644 -- mime.h $(DESTDIR)$(PREFIX)/include/Desktop/mime.h $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop $(INSTALL) -m 0644 -- toolbar.h $(DESTDIR)$(PREFIX)/include/Desktop/toolbar.h @@ -35,6 +37,7 @@ uninstall: $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/assistant.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/compat.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/menubar.h + $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/message.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/mime.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/toolbar.h diff --git a/include/Desktop/message.h b/include/Desktop/message.h new file mode 100644 index 0000000..b3201b2 --- /dev/null +++ b/include/Desktop/message.h @@ -0,0 +1,27 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* This file is part of DeforaOS Desktop libDesktop */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#ifndef LIBDESKTOP_MESSAGE_H +# define LIBDESKTOP_MESSAGE_H + + +/* Message */ +/* functions */ +int desktop_message_send(char const * destination, uint32_t value1, + uint32_t value2, uint32_t value3); + +#endif /* !LIBDESKTOP_MESSAGE_H */ diff --git a/include/Desktop/project.conf b/include/Desktop/project.conf index 359a77d..d2de4b2 100644 --- a/include/Desktop/project.conf +++ b/include/Desktop/project.conf @@ -1,4 +1,4 @@ -includes=about.h,accel.h,assistant.h,compat.h,menubar.h,mime.h,toolbar.h +includes=about.h,accel.h,assistant.h,compat.h,menubar.h,message.h,mime.h,toolbar.h dist=Makefile [about.h] @@ -16,6 +16,9 @@ install=$(PREFIX)/include/Desktop [menubar.h] install=$(PREFIX)/include/Desktop +[message.h] +install=$(PREFIX)/include/Desktop + [mime.h] install=$(PREFIX)/include/Desktop diff --git a/src/Makefile b/src/Makefile index ec39327..7d6118f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,7 +19,7 @@ INSTALL ?= install all: $(TARGETS) -libDesktop_OBJS = about.o accel.o assistant.o menubar.o mime.o toolbar.o +libDesktop_OBJS = about.o accel.o assistant.o menubar.o message.o mime.o toolbar.o libDesktop_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) libDesktop_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) @@ -44,6 +44,9 @@ assistant.o: assistant.c menubar.o: menubar.c $(CC) $(libDesktop_CFLAGS) -c menubar.c +message.o: message.c + $(CC) $(libDesktop_CFLAGS) -c message.c + mime.o: mime.c $(CC) $(libDesktop_CFLAGS) -c mime.c diff --git a/src/message.c b/src/message.c new file mode 100644 index 0000000..df40714 --- /dev/null +++ b/src/message.c @@ -0,0 +1,41 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* This file is part of DeforaOS Desktop libDesktop */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#include +#include "Desktop.h" + + +/* Message */ +/* desktop_message_send */ +int desktop_message_send(char const * destination, uint32_t value1, + uint32_t value2, uint32_t value3) +{ + GdkEvent event; + GdkEventClient * client = &event.client; + + memset(&event, 0, sizeof(event)); + client->type = GDK_CLIENT_EVENT; + client->window = NULL; + client->send_event = TRUE; + client->message_type = gdk_atom_intern(destination, FALSE); + client->data_format = 8; + client->data.b[0] = value1; + client->data.b[1] = value2; + client->data.b[2] = value3; + gdk_event_send_clientmessage_toall(&event); + return 0; +} diff --git a/src/project.conf b/src/project.conf index 01cfb35..ed1e0b4 100644 --- a/src/project.conf +++ b/src/project.conf @@ -7,5 +7,5 @@ dist=Makefile [libDesktop] type=library -sources=about.c,accel.c,assistant.c,menubar.c,mime.c,toolbar.c +sources=about.c,accel.c,assistant.c,menubar.c,message.c,mime.c,toolbar.c install=$(PREFIX)/lib