From 4f503e6e9c824176f29ecebf6b6adb5e24567214 Mon Sep 17 00:00:00 2001 From: iovar Date: Fri, 8 Jun 2007 17:13:18 +0000 Subject: get_frame.c: calculate x and y offset of the cursor so that it will appear correctly. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@346 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/get_frame.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c index 7021dde..9cdfc6a 100644 --- a/recordmydesktop/src/get_frame.c +++ b/recordmydesktop/src/get_frame.c @@ -280,9 +280,18 @@ void *GetFrame(ProgData *pdata){ pthread_mutex_unlock(&pdata->yuv_mutex); } if(pdata->args.xfixes_cursor){ + int mouse_xoffset, + mouse_yoffset; //avoid segfaults CLIP_DUMMY_POINTER_AREA(mouse_pos_abs,&pdata->brwin, &mouse_pos_temp); + mouse_xoffset=mouse_pos_temp.x-mouse_pos_abs.x; + mouse_yoffset=mouse_pos_temp.y-mouse_pos_abs.y; + if((mouse_xoffset<0) || (mouse_xoffset>mouse_pos_abs.width)) + mouse_xoffset=0; + if((mouse_yoffset<0) || (mouse_yoffset>mouse_pos_abs.height)) + mouse_yoffset=0; + //draw the cursor if((mouse_pos_temp.x>=0)&& (mouse_pos_temp.y>=0)&& @@ -298,6 +307,8 @@ void *GetFrame(ProgData *pdata){ pdata->enc_data->y_offset), mouse_pos_temp.width, mouse_pos_temp.height, + mouse_xoffset, + mouse_yoffset, (xcim->width-mouse_pos_temp.width)); } XFree(xcim); @@ -305,9 +316,17 @@ void *GetFrame(ProgData *pdata){ } if(pdata->args.have_dummy_cursor){ + int mouse_xoffset, + mouse_yoffset; //avoid segfaults CLIP_DUMMY_POINTER_AREA(mouse_pos_abs,&pdata->brwin, &mouse_pos_temp); + mouse_xoffset=mouse_pos_temp.x-mouse_pos_abs.x; + mouse_yoffset=mouse_pos_temp.y-mouse_pos_abs.y; + if((mouse_xoffset<0) || (mouse_xoffset>mouse_pos_abs.width)) + mouse_xoffset=0; + if((mouse_yoffset<0) || (mouse_yoffset>mouse_pos_abs.height)) + mouse_yoffset=0; //draw the cursor if((mouse_pos_temp.x>=0)&& (mouse_pos_temp.y>=0)&& @@ -323,6 +342,8 @@ void *GetFrame(ProgData *pdata){ pdata->enc_data->y_offset), mouse_pos_temp.width, mouse_pos_temp.height, + mouse_xoffset, + mouse_yoffset, pdata->npxl); } } -- cgit v1.2.1