Removed unused arguments from gdk_fb_drawable_get_pixel().
2000-11-20 Alexander Larsson <alla@lysator.liu.se> * gdk/linux-fb/gdkdrawable-fb2.c: Removed unused arguments from gdk_fb_drawable_get_pixel(). * gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2): Renamed fidur specific mouse packet data in MouseDevice to generic. Used it in ps2 mouse handling code to avoid blocking reads.
This commit is contained in:
committed by
Alexander Larsson
parent
c9e39436b9
commit
2999f465b4
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
2000-11-20 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||||
|
Removed unused arguments from gdk_fb_drawable_get_pixel().
|
||||||
|
|
||||||
|
* gdk/linux-fb/gdkinput-ps2.c (handle_input_ps2):
|
||||||
|
Renamed fidur specific mouse packet data in MouseDevice to
|
||||||
|
generic. Used it in ps2 mouse handling code to avoid blocking
|
||||||
|
reads.
|
||||||
|
|
||||||
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
Sat Nov 18 18:00:17 2000 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* demos/gtk-demo/main.c: Changed to have the list become
|
* demos/gtk-demo/main.c: Changed to have the list become
|
||||||
|
|||||||
@ -14,10 +14,7 @@ static GetPixelRet gdk_fb_drawable_get_pixel (GdkDrawable *drawable,
|
|||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
GdkColor *spot,
|
GdkColor *spot);
|
||||||
gboolean abs_coords,
|
|
||||||
GdkDrawable *bg_relto,
|
|
||||||
GdkDrawable *bgpm);
|
|
||||||
void gdk_fb_draw_rectangle (GdkDrawable *drawable,
|
void gdk_fb_draw_rectangle (GdkDrawable *drawable,
|
||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
gint filled,
|
gint filled,
|
||||||
@ -798,22 +795,13 @@ gdk_fb_drawable_get_pixel (GdkDrawable *drawable,
|
|||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
GdkColor *spot,
|
GdkColor *spot)
|
||||||
gboolean abs_coords,
|
|
||||||
GdkDrawable *bg_relto,
|
|
||||||
GdkDrawable *bgpm)
|
|
||||||
{
|
{
|
||||||
GetPixelRet retval = GPR_NONE;
|
GetPixelRet retval = GPR_NONE;
|
||||||
GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
|
GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
|
||||||
guchar *mem = private->mem;
|
guchar *mem = private->mem;
|
||||||
guint rowstride = private->rowstride;
|
guint rowstride = private->rowstride;
|
||||||
|
|
||||||
if (!abs_coords)
|
|
||||||
{
|
|
||||||
x += private->abs_x;
|
|
||||||
y += private->abs_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (private->depth)
|
switch (private->depth)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -824,21 +812,7 @@ gdk_fb_drawable_get_pixel (GdkDrawable *drawable,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval = GPR_USED_BG;
|
retval = GPR_USED_BG;
|
||||||
|
*spot = GDK_GC_FBDATA (gc)->values.background;
|
||||||
if (bgpm)
|
|
||||||
{
|
|
||||||
int bgx, bgy;
|
|
||||||
|
|
||||||
bgx = (x - GDK_DRAWABLE_IMPL_FBDATA (bg_relto)->abs_x) % GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width;
|
|
||||||
bgy = (y - GDK_DRAWABLE_IMPL_FBDATA (bg_relto)->abs_y) % GDK_DRAWABLE_IMPL_FBDATA (bgpm)->height;
|
|
||||||
|
|
||||||
gdk_fb_drawable_get_pixel (bgpm, gc, bgx, bgy, spot, FALSE, NULL, NULL);
|
|
||||||
retval = GPR_USED_BG;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*spot = GDK_GC_FBDATA (gc)->values.background;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1242,7 +1216,7 @@ gdk_fb_draw_drawable_generic (GdkDrawable *drawable,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (gdk_fb_drawable_get_pixel (src, gc, cur_x + src_x_off, cur_y + src_y_off, &spot, TRUE, NULL, NULL))
|
switch (gdk_fb_drawable_get_pixel (src, gc, cur_x + src_x_off, cur_y + src_y_off, &spot))
|
||||||
{
|
{
|
||||||
case GPR_AA_GRAYVAL:
|
case GPR_AA_GRAYVAL:
|
||||||
{
|
{
|
||||||
@ -1279,9 +1253,9 @@ gdk_fb_draw_drawable_generic (GdkDrawable *drawable,
|
|||||||
{
|
{
|
||||||
int bgx, bgy;
|
int bgx, bgy;
|
||||||
|
|
||||||
bgx = (cur_x - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_x) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->width;
|
bgx = (cur_x - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_x) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->width + private->abs_x;
|
||||||
bgy = (cur_y - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_y) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->height;
|
bgy = (cur_y - GDK_DRAWABLE_IMPL_FBDATA (dc->bg_relto)->abs_y) % GDK_DRAWABLE_IMPL_FBDATA (dc->bgpm)->height + private->abs_y;
|
||||||
gdk_fb_drawable_get_pixel (dc->bgpm, gc, bgx, bgy, &realspot, FALSE, NULL, NULL);
|
gdk_fb_drawable_get_pixel (dc->bgpm, gc, bgx, bgy, &realspot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GPR_NONE:
|
case GPR_NONE:
|
||||||
|
|||||||
@ -57,8 +57,8 @@ typedef struct {
|
|||||||
gboolean button1_pressed, button2_pressed, button3_pressed;
|
gboolean button1_pressed, button2_pressed, button3_pressed;
|
||||||
gboolean click_grab;
|
gboolean click_grab;
|
||||||
|
|
||||||
guchar fidmour_bytes[5];
|
guchar mouse_packet[5];
|
||||||
int fidmour_nbytes;
|
int packet_nbytes;
|
||||||
} MouseDevice;
|
} MouseDevice;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -652,7 +652,7 @@ pull_fidmour_packet (MouseDevice *mouse,
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = read (mouse->fd, mouse->fidmour_bytes + mouse->fidmour_nbytes, 5 - mouse->fidmour_nbytes);
|
n = read (mouse->fd, mouse->mouse_packet + mouse->packet_nbytes, 5 - mouse->packet_nbytes);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (n == 0)
|
else if (n == 0)
|
||||||
@ -662,31 +662,31 @@ pull_fidmour_packet (MouseDevice *mouse,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse->fidmour_nbytes += n;
|
mouse->packet_nbytes += n;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
if (!(mouse->fidmour_bytes[0] & 0x80))
|
if (!(mouse->mouse_packet[0] & 0x80))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/* We haven't received any of the packet yet but there is no header at the beginning */
|
/* We haven't received any of the packet yet but there is no header at the beginning */
|
||||||
for (i = 1; i < mouse->fidmour_nbytes; i++)
|
for (i = 1; i < mouse->packet_nbytes; i++)
|
||||||
{
|
{
|
||||||
if (mouse->fidmour_bytes[i] & 0x80)
|
if (mouse->mouse_packet[i] & 0x80)
|
||||||
{
|
{
|
||||||
n = i;
|
n = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mouse->fidmour_nbytes > 1 &&
|
else if (mouse->packet_nbytes > 1 &&
|
||||||
((mouse->fidmour_bytes[0] & 0x90) == 0x90))
|
((mouse->mouse_packet[0] & 0x90) == 0x90))
|
||||||
{
|
{
|
||||||
/* eat the 0x90 and following byte, no clue what it's for */
|
/* eat the 0x90 and following byte, no clue what it's for */
|
||||||
n = 2;
|
n = 2;
|
||||||
}
|
}
|
||||||
else if (mouse->fidmour_nbytes == 5)
|
else if (mouse->packet_nbytes == 5)
|
||||||
{
|
{
|
||||||
switch (mouse->fidmour_bytes[0] & 0xF)
|
switch (mouse->mouse_packet[0] & 0xF)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
*btn_down = 0;
|
*btn_down = 0;
|
||||||
@ -700,10 +700,10 @@ pull_fidmour_packet (MouseDevice *mouse,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*x = mouse->fidmour_bytes[1] + (mouse->fidmour_bytes[2] << 7);
|
*x = mouse->mouse_packet[1] + (mouse->mouse_packet[2] << 7);
|
||||||
if (*x > 8192)
|
if (*x > 8192)
|
||||||
*x -= 16384;
|
*x -= 16384;
|
||||||
*y = mouse->fidmour_bytes[3] + (mouse->fidmour_bytes[4] << 7);
|
*y = mouse->mouse_packet[3] + (mouse->mouse_packet[4] << 7);
|
||||||
if (*y > 8192)
|
if (*y > 8192)
|
||||||
*y -= 16384;
|
*y -= 16384;
|
||||||
/* Now map touchscreen coords to screen coords */
|
/* Now map touchscreen coords to screen coords */
|
||||||
@ -715,8 +715,8 @@ pull_fidmour_packet (MouseDevice *mouse,
|
|||||||
|
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
memmove (mouse->fidmour_bytes, mouse->fidmour_bytes+n, mouse->fidmour_nbytes-n);
|
memmove (mouse->mouse_packet, mouse->mouse_packet+n, mouse->packet_nbytes-n);
|
||||||
mouse->fidmour_nbytes -= n;
|
mouse->packet_nbytes -= n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,33 +773,32 @@ handle_input_ps2 (GIOChannel *gioc,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
MouseDevice *mouse = data;
|
MouseDevice *mouse = data;
|
||||||
guchar buf[3];
|
int n, dx=0, dy=0;
|
||||||
int n, left, dx=0, dy=0;
|
|
||||||
gboolean new_button1, new_button2, new_button3;
|
gboolean new_button1, new_button2, new_button3;
|
||||||
time_t the_time;
|
time_t the_time;
|
||||||
GTimeVal curtime;
|
GTimeVal curtime;
|
||||||
gboolean got_motion = FALSE;
|
gboolean got_motion = FALSE;
|
||||||
|
guchar *buf;
|
||||||
|
|
||||||
g_get_current_time (&curtime);
|
g_get_current_time (&curtime);
|
||||||
the_time = curtime.tv_usec;
|
the_time = curtime.tv_usec;
|
||||||
|
|
||||||
while (1) /* Go through as many mouse events as we can */
|
while (1) /* Go through as many mouse events as we can */
|
||||||
{
|
{
|
||||||
for (left = sizeof(buf); left > 0; )
|
n = read (mouse->fd, mouse->mouse_packet + mouse->packet_nbytes, 3 - mouse->packet_nbytes);
|
||||||
{
|
if (n<=0) /* error or nothing to read */
|
||||||
n = read (mouse->fd, buf+sizeof(buf)-left, left);
|
break;
|
||||||
|
|
||||||
|
mouse->packet_nbytes += n;
|
||||||
|
|
||||||
|
if (mouse->packet_nbytes < 3) /* Mouse packet not finished */
|
||||||
|
break;
|
||||||
|
|
||||||
if (n <= 0)
|
mouse->packet_nbytes = 0;
|
||||||
{
|
|
||||||
if (left != sizeof(buf))
|
|
||||||
continue; /* XXX FIXME - this will be slow compared to turning on blocking mode, etc. */
|
|
||||||
|
|
||||||
goto done_reading_mouse_events;
|
|
||||||
}
|
|
||||||
|
|
||||||
left -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Finished reading a packet */
|
||||||
|
buf = mouse->mouse_packet;
|
||||||
|
|
||||||
new_button1 = (buf[0] & 1) && 1;
|
new_button1 = (buf[0] & 1) && 1;
|
||||||
new_button3 = (buf[0] & 2) && 1;
|
new_button3 = (buf[0] & 2) && 1;
|
||||||
new_button2 = (buf[0] & 4) && 1;
|
new_button2 = (buf[0] & 4) && 1;
|
||||||
@ -848,7 +847,6 @@ handle_input_ps2 (GIOChannel *gioc,
|
|||||||
got_motion = TRUE;
|
got_motion = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
done_reading_mouse_events:
|
|
||||||
if (got_motion)
|
if (got_motion)
|
||||||
handle_mouse_input (mouse, TRUE);
|
handle_mouse_input (mouse, TRUE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user