[gephex-devel] gephex--main--0.4--patch-1871
gephex at sonnenland.kexbox.org
gephex at sonnenland.kexbox.org
Sat Apr 2 01:23:48 CEST 2005
Archive: gephex at gephex.org--2004
New revision: gephex--main--0.4--patch-1871
--
Revision: gephex--main--0.4--patch-1871
Archive: gephex at gephex.org--2004
Creator: The Gephex Source Archive <gephex at gephex.org>
Date: Sat Apr 2 01:20:47 CEST 2005
Standard-date: 2005-04-01 23:20:47 GMT
Modified-files: modules/pluc.py
modules/src/frboutmodule/x11output.c
New-patches: gephex at gephex.org--2004/gephex--main--0.4--patch-1871
martin at gephex.org--2004/gephex--martin--0.4--patch-65
martin at gephex.org--2004/gephex--martin--0.4--patch-66
Summary: [MERGE-REQUEST] pluc fix from michael
Keywords:
Patches applied:
* martin at gephex.org--2004/gephex--martin--0.4--patch-65
sync with main
* martin at gephex.org--2004/gephex--martin--0.4--patch-66
pluc.py patch from michael (part of bug #94)
* added files
{arch}/gephex/gephex--main/gephex--main--0.4/gephex at gephex.org--2004/patch-log/patch-1871
{arch}/gephex/gephex--martin/gephex--martin--0.4/martin at gephex.org--2004/patch-log/patch-65
{arch}/gephex/gephex--martin/gephex--martin--0.4/martin at gephex.org--2004/patch-log/patch-66
* modified files
--- orig/modules/pluc.py
+++ mod/modules/pluc.py
@@ -217,7 +217,7 @@
def createInputSpec(input):
(id,options) = input
if options.has_key('default'):
- default = 'default='+options['default']
+ default = 'default=['+options['default']+']'
else:
default = ''
--- orig/modules/src/frboutmodule/x11output.c
+++ mod/modules/src/frboutmodule/x11output.c
@@ -65,7 +65,7 @@
char* error_text, int text_len);
*/
static int init_xshm_stuff(struct DriverInstance* sh, char* error_text,
- int text_len);
+ int text_len, unsigned int size);
static void deinit_xshm_stuff(struct DriverInstance* sh);
@@ -103,6 +103,7 @@
XShmSegmentInfo shminfo;
int completion_type;
int event_pending;
+ unsigned int shm_size;
// used if Xv extension is available
XvPortID xv_port;
@@ -187,6 +188,7 @@
sh->xv_port = 0xffffffff;
sh->xv_format_id = -1;
sh->xv_image = 0;
+ sh->shm_size = 0;
if (strcmp(server_name,"default") == 0)
server_name_ptr = getenv("DISPLAY"); //use the DISPLAY environment variable
@@ -270,6 +272,15 @@
if ((sh->used_extensions & USE_XSHM) == USE_XSHM)
{
+ if (init_xshm_stuff(sh, error_text, text_len,
+ 640 * 480 * 4) == 0)
+ {
+ deinit_xv_stuff(sh);
+ XDestroyWindow(sh->display, sh->win);
+ free(sh);
+ return 0;
+ }
+
if ((sh->used_extensions & USE_XV) == 0)
{
/* create shared memory ximage */
@@ -446,6 +457,14 @@
convert_to_16_inplace(sh->ximage->data, sh->width, sh->height);
// blit shared mem image
+
+ // todo handle the error message
+ if ( sh->shm_size != sh->width * sh->height * 4 )
+ {
+ deinit_xshm_stuff(sh);
+ init_xshm_stuff( sh, 0, 0, sh->width * sh->height * 4 );
+ }
+
XShmPutImage(sh->display, sh->win, sh->gc, sh->ximage,
0, 0, 0, 0, sh->width, sh->height, True);
sh->event_pending = 1;
@@ -484,8 +503,14 @@
height != sh->image_height)
{
if (sh->xv_image)
- XFree(sh->xv_image);
+ {
+ XFree(sh->xv_image);
+ deinit_xshm_stuff(sh);
+ }
+
+ // todo handle the error message
+ init_xshm_stuff(sh,0 ,0 ,width*height*4);
sh->xv_image = XvShmCreateImage(sh->display,
sh->xv_port,
sh->xv_format_id,
@@ -925,28 +950,26 @@
/***************************************************************************/
static int init_xshm_stuff(struct DriverInstance* sh, char* error_text,
- int text_len)
+ int text_len, unsigned int size)
{
sh->completion_type = XShmGetEventBase(sh->display) + ShmCompletion;
sh->event_pending = 0;
/* allocate shared memory */
-
- // changed flags from 0777 to 0666, see
- // http://lists.apple.com/archives/unix-porting/2004/Apr/msg00081.html
sh->shminfo.shmid = shmget (IPC_PRIVATE,
- MAX_RES_X * MAX_RES_Y * 4,
- 0666 | IPC_CREAT);
+ size,
+ IPC_CREAT|0777);
if (sh->shminfo.shmid == -1)
{
- snprintf(error_text, text_len, "shmget() failed, errno=%i!", errno);
+ snprintf(error_text, text_len, "shmget() failed!");
return 0;
}
/* attach shared memory to our process */
sh->shminfo.shmaddr = shmat (sh->shminfo.shmid, 0, 0);
- if (sh->shminfo.shmaddr == (void*) -1) // TODO
+
+ if (sh->shminfo.shmaddr == -1)
{
shmctl (sh->shminfo.shmid, IPC_RMID, 0);
snprintf(error_text, text_len, "shmat() failed!");
@@ -967,6 +990,8 @@
return 0;
}
+ sh->shm_size=size; // remember the size og the shm segment
+
return 1;
}
@@ -981,6 +1006,8 @@
sh->shminfo.shmaddr = 0;
}
+
+ sh->shm_size=0; // remember the size og the shm segment
}
static int init_xv_stuff(struct DriverInstance* sh, char* error_text,
More information about the gephex-devel
mailing list