Implemented a temporary API of a message passing protocol for desktop applications

This commit is contained in:
Pierre Pronchery 2011-12-30 19:49:01 +00:00
parent f76425e18b
commit 1982180fba
8 changed files with 83 additions and 3 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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

27
include/Desktop/message.h Normal file
View File

@ -0,0 +1,27 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* 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 <http://www.gnu.org/licenses/>. */
#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 */

View File

@ -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

View File

@ -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

41
src/message.c Normal file
View File

@ -0,0 +1,41 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* 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 <http://www.gnu.org/licenses/>. */
#include <string.h>
#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;
}

View File

@ -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