]> git.pld-linux.org Git - packages/links2.git/blob - links-directfb.patch
- removed unnecessary patch (it was done in lame way)
[packages/links2.git] / links-directfb.patch
1 diff -uraN ../links-2.1pre9/Makefile.am ./Makefile.am
2 --- ../links-2.1pre9/Makefile.am        2002-06-08 15:11:51.000000000 +0200
3 +++ ./Makefile.am       2003-03-13 15:06:00.000000000 +0100
4 @@ -13,7 +13,7 @@
5  else
6  endif
7  
8 -links_SOURCES=af_unix.c beos.c bfu.c bookmarks.c builtin.c cache.c charsets.c connect.c context.c cookies.c default.c dip.c dither.c dns.c drivers.c error.c file.c finger.c font_include.c framebuffer.c ftp.c gif.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c ipret.c javascr.c javascript.c jpeg.c jsint.c kbd.c language.c links_icon.c listedit.c lru.c mailto.c main.c menu.c memory.c md5.c md5hl.c ns.c objreq.c os_dep.c pmshell.c png.c pomocny.c sched.c select.c session.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c win32.c x.c xbm.c links.h cfg.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc arrow.inc md5.h ns.h struct.h tree.h typy.h ipret.h javascript.h builtin.h builtin_keys.h bits.h
9 +links_SOURCES=af_unix.c beos.c bfu.c bookmarks.c builtin.c cache.c charsets.c connect.c context.c cookies.c default.c dip.c directfb.c directfb_cursors.h dither.c dns.c drivers.c error.c file.c finger.c font_include.c framebuffer.c ftp.c gif.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c ipret.c javascr.c javascript.c jpeg.c jsint.c kbd.c language.c links_icon.c listedit.c lru.c mailto.c main.c menu.c memory.c md5.c md5hl.c ns.c objreq.c os_dep.c pmshell.c png.c pomocny.c sched.c select.c session.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c win32.c x.c xbm.c links.h cfg.h os_dep.h os_depx.h setup.h codepage.h language.h codepage.inc entity.inc uni_7b.inc language.inc arrow.inc md5.h ns.h struct.h tree.h typy.h ipret.h javascript.h builtin.h builtin_keys.h bits.h
10  
11  dist-hook:
12  #remove the symlinka:
13 diff -uraN ../links-2.1pre9/acconfig.h ./acconfig.h
14 --- ../links-2.1pre9/acconfig.h 2002-05-02 22:40:11.000000000 +0200
15 +++ ./acconfig.h        2003-03-13 15:06:00.000000000 +0100
16 @@ -77,6 +77,9 @@
17  #undef GRDRV_FB
18  
19  /* */
20 +#undef GRDRV_DIRECTFB
21 +
22 +/* */
23  #undef GRDRV_PMSHELL
24  
25  /* */
26 diff -uraN ../links-2.1pre9/configure.in ./configure.in
27 --- ../links-2.1pre9/configure.in       2003-02-26 19:43:43.000000000 +0100
28 +++ ./configure.in      2003-03-13 15:13:22.000000000 +0100
29 @@ -336,6 +336,7 @@
30  AC_ARG_WITH(svgalib, [  --without-svgalib       compile without svgalib graphics driver],[if test "$withval" = no; then disable_svgalib=yes; else disable_svgalib=no; fi])
31  AC_ARG_WITH(x, [  --without-x             compile without X Window System graphics driver],[if test "$withval" = no; then disable_x=yes; else disable_x=no; fi])
32  AC_ARG_WITH(fb, [  --without-fb            compile without Linux Framebuffer graphics driver],[if test "$withval" = no; then disable_fb=yes; else disable_fb=no; fi])
33 +AC_ARG_WITH(directfb, [  --without-directfb      compile without DirectFB graphics driver],[if test "$withval" = no; then disable_directfb=yes; else disable_directfb=no; fi])
34  AC_ARG_WITH(pmshell, [  --without-pmshell       compile without PMShell graphics driver],[if test "$withval" = no; then disable_pmshell=yes; else disable_pmshell=no; fi])
35  AC_ARG_WITH(atheos, [  --without-atheos        compile without Atheos graphics driver],[if test "$withval" = no; then disable_atheos=yes; else disable_atheos; fi])
36  
37 @@ -374,6 +375,25 @@
38         fi
39  fi
40  
41 +if test "$disable_directfb" != yes ; then
42 +       AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no)
43 +       if test "$DIRECTFB_CONFIG" != "no"; then
44 +               AC_MSG_CHECKING(for DirectFB >= 0.9.17)
45 +               directfb_version=`$DIRECTFB_CONFIG --version`
46 +               if expr $directfb_version \>= 0.9.17 >/dev/null; then
47 +                       AC_MSG_RESULT(yes)
48 +                       DIRECTFB_CFLAGS=`$DIRECTFB_CONFIG --cflags`
49 +                       DIRECTFB_LIBS=`$DIRECTFB_CONFIG --libs`
50 +                       AC_DEFINE(GRDRV_DIRECTFB)
51 +                       drivers="$drivers DIRECTFB"
52 +                       CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
53 +                       LIBS="$LIBS $DIRECTFB_LIBS"
54 +               else
55 +                       AC_MSG_RESULT(no)
56 +               fi
57 +       fi
58 +fi
59 +
60         AC_PATH_X
61  
62         if test "$have_x" = yes; then
63 diff -uraN ../links-2.1pre9/default.c ./default.c
64 --- ../links-2.1pre9/default.c  2003-02-11 22:55:00.000000000 +0100
65 +++ ./default.c 2003-03-13 15:06:00.000000000 +0100
66 @@ -79,6 +79,10 @@
67                                         goto found;
68                                 }
69                         uu:
70 +#ifdef GRDRV_DIRECTFB
71 +                        if (!strncmp(argv[-1], "--dfb:", 6))
72 +                                goto found;
73 +#endif
74                         fprintf(stderr, "Unknown option %s\n", argv[-1]);
75                         return NULL;
76                 } else if (!u) u = argv[-1];
77 diff -uraN ../links-2.1pre9/directfb.c ./directfb.c
78 --- ../links-2.1pre9/directfb.c 1970-01-01 01:00:00.000000000 +0100
79 +++ ./directfb.c        2003-03-13 15:10:53.000000000 +0100
80 @@ -0,0 +1,847 @@
81 +/* directfb.c
82 + * DirectFB graphics driver
83 + * (c) 2002 Sven Neumann <sven@directfb.org>
84 + *
85 + * This file is a part of the Links program, released under GPL.
86 + */
87 +
88 +/* TODO:
89 + * - Store window size as driver params (?)
90 + * - Fix wrong colors on big-endian systems (fixed?)
91 + * - Make everything work correctly ;-)
92 + *
93 + * KNOWN PROBLEMS:
94 + * - If mouse drags don't work for you, update DirectFB
95 + *   (the upcoming 0.9.14 release fixes this).
96 + */
97 +
98 +
99 +#include "cfg.h"
100 +
101 +#ifdef GRDRV_DIRECTFB
102 +
103 +#ifdef TEXT
104 +#undef TEXT
105 +#endif
106 +
107 +#include <netinet/in.h>  /* for htons */
108 +
109 +#include <directfb.h>
110 +
111 +#include "links.h"
112 +#include "directfb_cursors.h"
113 +
114 +
115 +#define FOCUSED_OPACITY    0xFF
116 +#define UNFOCUSED_OPACITY  0xC0
117 +
118 +#define DIRECTFB_HASH_TABLE_SIZE  23
119 +struct graphics_device **directfb_hash_table[DIRECTFB_HASH_TABLE_SIZE];
120 +
121 +typedef struct _DFBDeviceData DFBDeviceData;
122 +struct _DFBDeviceData
123 +{
124 +  DFBWindowID       id;
125 +  IDirectFBWindow  *window;
126 +  IDirectFBSurface *surface;
127 +  int               mapped;
128 +  DFBRegion         flip_region;
129 +  int               flip_pending;
130 +};
131 +
132 +
133 +extern struct graphics_driver directfb_driver;
134 +
135 +static IDirectFB             *dfb         = NULL;
136 +static IDirectFBDisplayLayer *layer       = NULL;
137 +static IDirectFBSurface      *arrow       = NULL;
138 +static IDirectFBEventBuffer  *events      = NULL;
139 +static DFBSurfacePixelFormat  pixelformat = DSPF_UNKNOWN;
140 +static int                    event_timer = 0;
141 +
142 +
143 +static inline void directfb_set_color  (IDirectFBSurface *surface, long color);
144 +static void directfb_register_flip     (DFBDeviceData *data,
145 +                                        int x, int y, int w, int h);
146 +static void directfb_flip_surface      (void *pointer);
147 +static void directfb_check_events      (void *pointer);
148 +static void directfb_translate_key     (DFBWindowEvent *event,
149 +                                        int *key, int *flag);
150 +static void directfb_add_to_table      (struct graphics_device *gd);
151 +static void directfb_remove_from_table (struct graphics_device *gd);
152 +static struct graphics_device * directfb_lookup_in_table (DFBWindowID  id);
153 +
154 +
155 +static unsigned char *
156 +directfb_fb_init_driver (unsigned char *param, unsigned char *display)
157 +{
158 +  DFBDisplayLayerConfig  config;
159 +  DFBResult              ret;
160 +
161 +  if (dfb)
162 +    return NULL;
163 +
164 +  DirectFBInit (&g_argc, (char ***) &g_argv);
165 +  ret = DirectFBCreate (&dfb);
166 +
167 +  if (ret)
168 +    {
169 +      char message[128];
170 +
171 +      snprintf (message, sizeof (message), "%s\n", DirectFBErrorString (ret));
172 +      return stracpy (message);
173 +    }
174 +
175 +  dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);
176 +
177 +  layer->GetConfiguration (layer, &config);
178 +
179 +  pixelformat = config.pixelformat;
180 +
181 +  directfb_driver.depth = (((DFB_BYTES_PER_PIXEL (pixelformat) & 0x7)) |
182 +                           ((DFB_BITS_PER_PIXEL  (pixelformat) & 0x1F) << 3));
183 +
184 +  /* endian test */
185 +  if (htons (0x1234) == 0x1234)
186 +    directfb_driver.depth |= 0x100;
187 +
188 +  directfb_driver.x = config.width;
189 +  directfb_driver.y = config.height;
190 +
191 +  memset (directfb_hash_table, 0, sizeof (directfb_hash_table));
192 +
193 +  if (dfb->CreateSurface (dfb, &arrow_desc, &arrow) != DFB_OK)
194 +    arrow = NULL;
195 +
196 +  return NULL;
197 +}
198 +
199 +static struct graphics_device *
200 +directfb_init_device (void)
201 +{
202 +  struct graphics_device *gd;
203 +  DFBDeviceData          *data;
204 +  IDirectFBWindow        *window;
205 +  DFBWindowDescription    desc;
206 +
207 +  if (!dfb || !layer)
208 +    return NULL;
209 +
210 +  desc.flags  = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
211 +  desc.width  = directfb_driver.x;
212 +  desc.height = directfb_driver.y;
213 +  desc.posx   = 0;
214 +  desc.posy   = 0;
215 +
216 +  if (layer->CreateWindow (layer, &desc, &window) != DFB_OK)
217 +    return NULL;
218 +
219 +  gd = mem_alloc (sizeof (struct graphics_device));
220 +
221 +  gd->size.x1 = 0;
222 +  gd->size.y1 = 0;
223 +  window->GetSize (window, &gd->size.x2, &gd->size.y2);
224 +
225 +  gd->clip = gd->size;
226 +
227 +  data = mem_alloc (sizeof (DFBDeviceData));
228 +  
229 +  data->window       = window;
230 +  data->mapped       = 0;
231 +  data->flip_pending = 0;
232 +
233 +  if (arrow)
234 +    window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
235 +
236 +  window->GetSurface (window, &data->surface);
237 +  window->GetID (window, &data->id);
238 +
239 +  gd->drv = &directfb_driver;
240 +  gd->driver_data = data;
241 +  gd->user_data   = NULL;
242 +
243 +  directfb_add_to_table (gd);
244 +
245 +  if (!events)
246 +    {
247 +      window->CreateEventBuffer (window, &events);
248 +      event_timer = install_timer (20, directfb_check_events, events);
249 +    }
250 +  else
251 +    {
252 +      window->AttachEventBuffer (window, events);
253 +    }
254 +
255 +  return gd;
256 +}
257 +
258 +static void
259 +directfb_shutdown_device (struct graphics_device *gd)
260 +{
261 +  DFBDeviceData *data;
262 +
263 +  if (!gd)
264 +    return;
265 +
266 +  data = gd->driver_data;
267 +
268 +  unregister_bottom_half (directfb_flip_surface, data);
269 +  directfb_remove_from_table (gd);
270 +
271 +  data->surface->Release (data->surface);
272 +  data->window->Release (data->window);
273 +
274 +  mem_free (data);
275 +  mem_free (gd);
276 +}
277 +
278 +static void
279 +directfb_shutdown_driver (void)
280 +{
281 +  int i;
282 +
283 +  if (!dfb)
284 +    return;
285 +
286 +  if (events)
287 +    {
288 +      kill_timer (event_timer);
289 +      events->Release (events);
290 +      events = NULL;
291 +    }
292 +
293 +  if (arrow)
294 +    arrow->Release (arrow);
295 +
296 +  layer->Release (layer);
297 +  dfb->Release (dfb);
298 +
299 +  for (i = 0; i < DIRECTFB_HASH_TABLE_SIZE; i++)
300 +    if (directfb_hash_table[i])
301 +      mem_free (directfb_hash_table[i]);
302 +
303 +  dfb = NULL;
304 +}
305 +
306 +static unsigned char *
307 +directfb_get_driver_param (void)
308 +{
309 +  return NULL;
310 +}
311 +
312 +static int
313 +directfb_get_empty_bitmap (struct bitmap *bmp)
314 +{
315 +  IDirectFBSurface      *surface;
316 +  DFBSurfaceDescription  desc;
317 +
318 +  bmp->data = bmp->flags = NULL;
319 +
320 +  desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
321 +  desc.width  = bmp->x;
322 +  desc.height = bmp->y;
323 +
324 +  if (dfb->CreateSurface (dfb, &desc, &surface) != DFB_OK)
325 +    return 0;
326 +
327 +  surface->Lock (surface, DSLF_READ | DSLF_WRITE, &bmp->data, &bmp->skip);
328 +
329 +  bmp->flags = surface;
330 +
331 +  return 0;
332 +}
333 +
334 +static int
335 +directfb_get_filled_bitmap (struct bitmap *bmp, long color)
336 +{
337 +  IDirectFBSurface      *surface;
338 +  DFBSurfaceDescription  desc;
339 +
340 +  bmp->data = bmp->flags = NULL;
341 +
342 +  desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT;
343 +  desc.width  = bmp->x;
344 +  desc.height = bmp->y;
345 +
346 +  if (dfb->CreateSurface (dfb, &desc, &surface) != DFB_OK)
347 +    return 0;
348 +
349 +  directfb_set_color (surface, color);
350 +  surface->FillRectangle (surface, 0, 0, bmp->x, bmp->y);
351 +  surface->Lock (surface, DSLF_READ | DSLF_WRITE, &bmp->data, &bmp->skip);
352 +
353 +  bmp->flags = surface;
354 +
355 +  return 0;
356 +}
357 +
358 +static void
359 +directfb_register_bitmap (struct bitmap *bmp)
360 +{
361 +  IDirectFBSurface *surface = bmp->flags;
362 +
363 +  surface->Unlock (surface);
364 +  bmp->data = NULL;
365 +}
366 +
367 +static void *
368 +directfb_prepare_strip (struct bitmap *bmp, int top, int lines)
369 +{
370 +  IDirectFBSurface *surface = bmp->flags;
371 +
372 +  surface->Lock (surface, DSLF_READ | DSLF_WRITE, &bmp->data, &bmp->skip);
373 +
374 +  return ((unsigned char *) bmp->data + top * bmp->skip);
375 +}
376 +
377 +static void
378 +directfb_commit_strip (struct bitmap *bmp, int top, int lines)
379 +{
380 +  IDirectFBSurface *surface = bmp->flags;
381 +
382 +  surface->Unlock (surface);
383 +  bmp->data = NULL;
384 +}
385 +
386 +static void
387 +directfb_unregister_bitmap (struct bitmap *bmp)
388 +{
389 +  IDirectFBSurface *surface = bmp->flags;
390 +
391 +  surface->Release (surface);
392 +}
393 +
394 +static void
395 +directfb_draw_bitmap (struct graphics_device *gd, struct bitmap *bmp,
396 +                      int x, int y)
397 +{
398 +  DFBDeviceData    *data = gd->driver_data;
399 +  IDirectFBSurface *src  = bmp->flags;
400 +
401 +  data->surface->Blit (data->surface, src, NULL, x, y);
402 +
403 +  directfb_register_flip (data, x, y, bmp->x, bmp->y);
404 +}
405 +
406 +static void
407 +directfb_draw_bitmaps (struct graphics_device *gd, struct bitmap **bmps,
408 +                       int n, int x, int y)
409 +{
410 +  DFBDeviceData *data = gd->driver_data;
411 +  struct bitmap *bmp  = *bmps;
412 +  int x1 = x;
413 +  int h  = 0;
414 +
415 +  if (n < 1)
416 +    return;
417 +
418 +  do
419 +    {
420 +      IDirectFBSurface *src = bmp->flags;
421 +      
422 +      data->surface->Blit (data->surface, src, NULL, x, y);
423 +
424 +      if (h < bmp->y)
425 +        h = bmp->y;
426 +
427 +      x += bmp->x;
428 +      bmp++;
429 +    }
430 +  while (--n);
431 +
432 +  directfb_register_flip (data, x1, y, x - x1, h);
433 +}
434 +
435 +static long
436 +directfb_get_color (int rgb)
437 +{
438 +  return rgb;
439 +}
440 +
441 +
442 +static void
443 +directfb_fill_area (struct graphics_device *gd,
444 +                    int x1, int y1, int x2, int y2, long color)
445 +{
446 +  DFBDeviceData *data = gd->driver_data;
447 +  int w = x2 - x1;
448 +  int h = y2 - y1;
449 +
450 +  directfb_set_color (data->surface, color);
451 +  data->surface->FillRectangle (data->surface, x1, y1, w, h);
452 +
453 +  directfb_register_flip (data, x1, y1, w, h);
454 +}
455 +
456 +static void
457 +directfb_draw_hline (struct graphics_device *gd,
458 +                     int left, int y, int right, long color)
459 +{
460 +  DFBDeviceData *data = gd->driver_data;
461 +
462 +  right--;
463 +
464 +  directfb_set_color (data->surface, color);
465 +  data->surface->DrawLine (data->surface, left, y, right, y);
466 +
467 +  directfb_register_flip (data, left, y, right - left, 1);
468 +}
469 +
470 +static void
471 +directfb_draw_vline (struct graphics_device *gd,
472 +                     int x, int top, int bottom, long color)
473 +{
474 +  DFBDeviceData *data = gd->driver_data;
475 +  
476 +  bottom--;
477 +
478 +  directfb_set_color (data->surface, color);
479 +  data->surface->DrawLine (data->surface, x, top, x, bottom);
480 +
481 +  directfb_register_flip (data, x, top, 1, bottom - top);
482 +}
483 +
484 +static void
485 +directfb_set_clip_area (struct graphics_device *gd, struct rect *r)
486 +{
487 +  DFBDeviceData *data   = gd->driver_data;
488 +  DFBRegion      region = { r->x1, r->y1, r->x2 - 1, r->y2 - 1};
489 +
490 +  gd->clip = *r;
491 +  
492 +  data->surface->SetClip (data->surface, &region);
493 +}
494 +
495 +static int
496 +directfb_hscroll (struct graphics_device *gd, struct rect_set **set, int sc)
497 +{
498 +  DFBDeviceData *data = gd->driver_data;
499 +  DFBRectangle   rect;
500 +
501 +  *set = NULL;
502 +  if (!sc)
503 +    return 0;
504 +
505 +  rect.x = gd->clip.x1;
506 +  rect.y = gd->clip.y1;
507 +  rect.w = gd->clip.x2 - rect.x;
508 +  rect.h = gd->clip.y2 - rect.y;
509 +
510 +  data->surface->Blit (data->surface,
511 +                       data->surface, &rect, rect.x + sc, rect.y);
512 +
513 +  directfb_register_flip (data, rect.x, rect.y, rect.w, rect.h);
514 +
515 +  return 1;
516 +}
517 +
518 +static int
519 +directfb_vscroll (struct graphics_device *gd, struct rect_set **set, int sc)
520 +{
521 +  DFBDeviceData *data = gd->driver_data;
522 +  DFBRectangle   rect;
523 +
524 +  *set = NULL;
525 +  if (!sc)
526 +    return 0;
527 +
528 +  rect.x = gd->clip.x1;
529 +  rect.y = gd->clip.y1;
530 +  rect.w = gd->clip.x2 - rect.x;
531 +  rect.h = gd->clip.y2 - rect.y;
532 +
533 +  data->surface->Blit (data->surface,
534 +                       data->surface, &rect, rect.x, rect.y + sc);
535 +
536 +  directfb_register_flip (data, rect.x, rect.y, rect.w, rect.h);
537 +
538 +  return 1;
539 +}
540 +
541 +struct graphics_driver directfb_driver = 
542 +{
543 +  "DirectFB",
544 +  directfb_fb_init_driver,
545 +  directfb_init_device,
546 +  directfb_shutdown_device,
547 +  directfb_shutdown_driver,
548 +  directfb_get_driver_param,
549 +  directfb_get_empty_bitmap,
550 +  directfb_get_filled_bitmap,
551 +  directfb_register_bitmap,
552 +  directfb_prepare_strip,
553 +  directfb_commit_strip,
554 +  directfb_unregister_bitmap,
555 +  directfb_draw_bitmap,
556 +  directfb_draw_bitmaps,
557 +  directfb_get_color,
558 +  directfb_fill_area,
559 +  directfb_draw_hline,
560 +  directfb_draw_vline,
561 +  directfb_hscroll,
562 +  directfb_vscroll,
563 +  directfb_set_clip_area,
564 +  dummy_block,
565 +  dummy_unblock,
566 +  NULL,         /*  set_title  */
567 +  0,    /*  depth      */
568 +  0, 0,         /*  size       */
569 +  0,     /*  flags      */
570 +  0      /*  codepage   */
571 +};
572 +
573 +
574 +static inline void directfb_set_color (IDirectFBSurface *surface, long color)
575 +{
576 +  surface->SetColor (surface,
577 +                     (color & 0xFF0000) >> 16,
578 +                     (color & 0xFF00)   >> 8,
579 +                     (color & 0xFF),
580 +                     0xFF);
581 +}
582 +
583 +static void directfb_register_flip (DFBDeviceData *data,
584 +                                    int x, int y, int w, int h)
585 +{
586 +  if (x < 0 || y < 0 || w < 1 || h < 1)
587 +    return;
588 +
589 +  w = x + w - 1;
590 +  h = y + h - 1;
591 +
592 +  if (data->flip_pending)
593 +    {
594 +      if (data->flip_region.x1 > x)  data->flip_region.x1 = x;
595 +      if (data->flip_region.y1 > y)  data->flip_region.y1 = y;
596 +      if (data->flip_region.x2 < w)  data->flip_region.x2 = w;
597 +      if (data->flip_region.y2 < h)  data->flip_region.y2 = h;
598 +    }
599 +  else
600 +    {
601 +      data->flip_region.x1 = x;
602 +      data->flip_region.y1 = y;
603 +      data->flip_region.x2 = w;
604 +      data->flip_region.y2 = h;
605
606 +      data->flip_pending = 1;
607 +
608 +      register_bottom_half (directfb_flip_surface, data);
609 +    }
610 +}
611 +
612 +static void
613 +directfb_flip_surface (void *pointer)
614 +{
615 +  DFBDeviceData *data = pointer;
616 +
617 +  if (!data->flip_pending)
618 +    return;
619 +
620 +  data->surface->Flip (data->surface, &data->flip_region, 0);
621 +
622 +  data->flip_pending = 0;
623 +}
624 +
625 +static void
626 +directfb_check_events (void *pointer)
627 +{
628 +  struct graphics_device *gd   = NULL;
629 +  DFBDeviceData          *data = NULL;
630 +  DFBWindowEvent          event;
631 +  DFBWindowEvent          next;
632 +
633 +  if (!events)
634 +    return;
635 +
636 +  while (events->GetEvent (events, DFB_EVENT (&event)) == DFB_OK)
637 +    {
638 +      switch (event.type)
639 +        {
640 +        case DWET_GOTFOCUS:
641 +        case DWET_LOSTFOCUS:
642 +        case DWET_POSITION_SIZE:
643 +        case DWET_SIZE:
644 +        case DWET_KEYDOWN:
645 +        case DWET_BUTTONDOWN:
646 +        case DWET_BUTTONUP:
647 +        case DWET_WHEEL:
648 +        case DWET_MOTION:
649 +          break;
650 +        default:
651 +          continue;
652 +        }
653 +
654 +      if (!data || data->id != event.window_id)
655 +        {
656 +          gd = directfb_lookup_in_table (event.window_id);
657 +          if (!gd)
658 +            continue;
659 +        }
660 +
661 +      data = gd->driver_data;
662 +
663 +      switch (event.type)
664 +        {
665 +        case DWET_GOTFOCUS:
666 +          data->window->SetOpacity (data->window, FOCUSED_OPACITY);
667 +          break;
668 +
669 +        case DWET_LOSTFOCUS:
670 +          data->window->SetOpacity (data->window, UNFOCUSED_OPACITY);
671 +          break;
672 +
673 +        case DWET_POSITION_SIZE:
674 +          if (!data->mapped)
675 +            {
676 +              struct rect r = { 0, 0, event.w, event.h };
677 +              
678 +              gd->redraw_handler (gd, &r);
679 +              data->window->SetOpacity (data->window, FOCUSED_OPACITY);
680 +              data->mapped = 1;
681 +            }
682 +          else
683 +          /* fallthru */
684 +        case DWET_SIZE:
685 +          while ((events->PeekEvent (events, DFB_EVENT (&next)) == DFB_OK)   &&
686 +                 (next.type == DWET_SIZE || next.type == DWET_POSITION_SIZE) &&
687 +                 (next.window_id == data->id))
688 +            events->GetEvent (events, DFB_EVENT (&event));
689 +
690 +          gd->size.x2 = event.w;
691 +          gd->size.y2 = event.h;
692 +          gd->resize_handler (gd);
693 +          break;
694 +
695 +        case DWET_KEYDOWN:
696 +          {
697 +            int key, flag;
698 +
699 +            directfb_translate_key (&event, &key, &flag);
700 +            if (key)
701 +              gd->keyboard_handler (gd, key, flag);
702 +          }
703 +          break;
704 +
705 +        case DWET_BUTTONDOWN:
706 +        case DWET_BUTTONUP:
707 +          {
708 +            int flags;
709 +
710 +            if (event.type == DWET_BUTTONUP)
711 +              {
712 +                flags = B_UP;
713 +                data->window->UngrabPointer (data->window);
714 +              }
715 +            else
716 +              {
717 +                flags = B_DOWN;
718 +                data->window->GrabPointer (data->window);
719 +              }
720 +
721 +            switch (event.button)
722 +              {
723 +              case DIBI_LEFT:
724 +                flags |= B_LEFT;
725 +                break;
726 +              case DIBI_RIGHT:
727 +                flags |= B_RIGHT;
728 +                break;
729 +              case DIBI_MIDDLE:
730 +                flags |= B_MIDDLE;
731 +                break;
732 +              default:
733 +                continue;
734 +              }
735 +
736 +            gd->mouse_handler (gd, event.x, event.y, flags);
737 +          }
738 +          break;
739 +
740 +        case DWET_WHEEL:
741 +          gd->mouse_handler (gd, event.x, event.y,
742 +                             B_MOVE |
743 +                             (event.step > 0 ? B_WHEELUP : B_WHEELDOWN));
744 +
745 +        case DWET_MOTION:
746 +          {
747 +            int flags;
748 +
749 +            while ((events->PeekEvent (events, DFB_EVENT (&next)) == DFB_OK) &&
750 +                   (next.type      == DWET_MOTION)                           &&
751 +                   (next.window_id == data->id))
752 +              events->GetEvent (events, DFB_EVENT (&event));
753 +
754 +            switch (event.buttons)
755 +              {
756 +              case DIBM_LEFT:
757 +                flags = B_DRAG | B_LEFT;
758 +                break;
759 +              case DIBM_RIGHT:
760 +                flags = B_DRAG | B_RIGHT;
761 +                break;
762 +              case DIBM_MIDDLE:
763 +                flags = B_DRAG | B_MIDDLE;
764 +                break;
765 +              default:
766 +                flags = B_MOVE;
767 +                break;
768 +              }
769 +
770 +            gd->mouse_handler (gd, event.x, event.y, flags);
771 +          }
772 +          break;
773 +
774 +        case DWET_CLOSE:
775 +          gd->keyboard_handler (gd, KBD_CLOSE, 0);
776 +          break;
777 +
778 +        default:
779 +          break;
780 +        }
781 +    }
782 +
783 +  event_timer = install_timer (20, directfb_check_events, events);
784 +}
785 +
786 +static void
787 +directfb_translate_key (DFBWindowEvent *event, int *key, int *flag)
788 +{
789 +  *key  = 0;
790 +  *flag = 0;
791 +
792 +  if (event->modifiers & DIMM_CONTROL && event->key_id == DIKI_C)
793 +    {
794 +      *key = KBD_CTRL_C;
795 +      return;
796 +    }
797 +
798 +  /* setting Shift seems to break things
799 +   *
800 +   *  if (event->modifiers & DIMM_SHIFT)
801 +   *     *flag |= KBD_SHIFT;
802 +   */
803 +  if (event->modifiers & DIMM_CONTROL)
804 +    *flag |= KBD_CTRL;
805 +  if (event->modifiers & DIMM_ALT)
806 +    *flag |= KBD_ALT;
807 +
808 +  switch (event->key_symbol)
809 +    {
810 +    case DIKS_ENTER:        *key = KBD_ENTER;     break;
811 +    case DIKS_BACKSPACE:    *key = KBD_BS;        break;
812 +    case DIKS_TAB:          *key = KBD_TAB;       break;
813 +    case DIKS_ESCAPE:       *key = KBD_ESC;       break;
814 +    case DIKS_CURSOR_UP:    *key = KBD_UP;        break;
815 +    case DIKS_CURSOR_DOWN:  *key = KBD_DOWN;      break;
816 +    case DIKS_CURSOR_LEFT:  *key = KBD_LEFT;      break;
817 +    case DIKS_CURSOR_RIGHT: *key = KBD_RIGHT;     break;
818 +    case DIKS_INSERT:       *key = KBD_INS;       break;
819 +    case DIKS_DELETE:       *key = KBD_DEL;       break;
820 +    case DIKS_HOME:         *key = KBD_HOME;      break;
821 +    case DIKS_END:          *key = KBD_END;       break;
822 +    case DIKS_PAGE_UP:      *key = KBD_PAGE_UP;   break;
823 +    case DIKS_PAGE_DOWN:    *key = KBD_PAGE_DOWN; break;
824 +    case DIKS_F1:           *key = KBD_F1;        break;
825 +    case DIKS_F2:           *key = KBD_F2;        break;
826 +    case DIKS_F3:           *key = KBD_F3;        break;
827 +    case DIKS_F4:           *key = KBD_F4;        break;
828 +    case DIKS_F5:           *key = KBD_F5;        break;
829 +    case DIKS_F6:           *key = KBD_F6;        break;
830 +    case DIKS_F7:           *key = KBD_F7;        break;
831 +    case DIKS_F8:           *key = KBD_F8;        break;
832 +    case DIKS_F9:           *key = KBD_F9;        break;
833 +    case DIKS_F10:          *key = KBD_F10;       break;
834 +    case DIKS_F11:          *key = KBD_F11;       break;
835 +    case DIKS_F12:          *key = KBD_F12;       break;
836 +
837 +    default:
838 +      if (DFB_KEY_TYPE (event->key_symbol) == DIKT_UNICODE)
839 +        *key = event->key_symbol;
840 +      break;
841 +    }
842 +}
843 +
844 +static void
845 +directfb_add_to_table (struct graphics_device *gd)
846 +{
847 +  DFBDeviceData           *data = gd->driver_data;
848 +  struct graphics_device **devices;
849 +  int i;
850 +
851 +  i = data->id % DIRECTFB_HASH_TABLE_SIZE;
852 +  
853 +  devices = directfb_hash_table[i];
854 +
855 +  if (devices)
856 +    {
857 +      int c = 0;
858 +
859 +      while (devices[c++])
860 +        ;
861 +
862 +      devices = mem_realloc (devices, (c + 1) * sizeof (void *));
863 +      devices[c-1] = gd;
864 +      devices[c]   = NULL;
865 +    }
866 +  else
867 +    {
868 +      devices = mem_alloc (2 * sizeof (void *));
869 +      devices[0] = gd;
870 +      devices[1] = NULL;
871 +    }
872 +
873 +  directfb_hash_table[i] = devices;
874 +}
875 +
876 +static void
877 +directfb_remove_from_table (struct graphics_device *gd)
878 +{
879 +  DFBDeviceData           *data = gd->driver_data;
880 +  struct graphics_device **devices;
881 +  int i, j, c;
882 +
883 +  i = data->id % DIRECTFB_HASH_TABLE_SIZE;
884 +
885 +  devices = directfb_hash_table[i];
886 +  if (!devices)
887 +    return;
888 +
889 +  for (j = 0, c = -1; devices[j]; j++)
890 +    if (devices[j] == gd)
891 +      c = j;
892 +
893 +  if (c < 0)
894 +    return;
895 +
896 +  memmove (devices + c, devices + c + 1, (j - c) * sizeof (void *));
897 +  devices = mem_realloc (devices, j * sizeof (void *));
898 +
899 +  directfb_hash_table[i] = devices;
900 +}
901 +
902 +static struct graphics_device *
903 +directfb_lookup_in_table (DFBWindowID id)
904 +{
905 +  struct graphics_device **devices;
906 +  int i;
907 +
908 +  i = id % DIRECTFB_HASH_TABLE_SIZE;
909 +
910 +  devices = directfb_hash_table[i];
911 +  if (!devices)
912 +    return NULL;
913 +
914 +  while (*devices)
915 +    {
916 +      DFBDeviceData *data = (*devices)->driver_data;
917 +
918 +      if (data->id == id)
919 +        return *devices;
920 +
921 +      devices++;
922 +    }
923 +
924 +  return NULL;
925 +}
926 +
927 +#endif /* GRDRV_DIRECTFB */
928 diff -uraN ../links-2.1pre9/directfb_cursors.h ./directfb_cursors.h
929 --- ../links-2.1pre9/directfb_cursors.h 1970-01-01 01:00:00.000000000 +0100
930 +++ ./directfb_cursors.h        2003-03-13 15:06:00.000000000 +0100
931 @@ -0,0 +1,80 @@
932 +/* DirectFB surface dump created by directfb-csource 0.9.14 */
933 +
934 +/* This arrow cursor surface is based on a cursor drawn by Ville Pätsi. */
935 +static unsigned char arrow_data[] = 
936 +  "\0\0\0\0\0\0\0#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
937 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
938 +  "\0\0\0\0\0\0/\253\253\253\320\0\0\0N\0\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0"
939 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
940 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0H\306\306\306\363\200\200\200\320\0\0\0Y\0"
941 +  "\0\0\21\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
942 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Z\377\377\377\377\301"
943 +  "\301\301\372\223\223\223\347\0\0\0k\0\0\0\30\0\0\0\6\0\0\0\2\0\0\0\1"
944 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
945 +  "\0\0\0\0\0]\377\377\377\377\377\377\377\377\264\264\264\373\213\213\213"
946 +  "\352\0\0\0u\0\0\0\36\0\0\0\10\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0"
947 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\377\377\377\377\375\375"
948 +  "\375\377\356\356\356\377\254\254\254\374\206\206\206\354\0\0\0y\0\0\0"
949 +  "!\0\0\0\10\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
950 +  "\0\0\0\0\0\0\0\0\0\0`\377\377\377\377\372\372\372\377\355\355\355\377"
951 +  "\343\343\343\377\247\247\247\374\203\203\203\354\0\0\0z\0\0\0\"\0\0\0"
952 +  "\11\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
953 +  "\0\0`\377\377\377\377\365\365\365\377\351\351\351\377\341\341\341\377"
954 +  "\335\335\335\377\243\243\243\374\177\177\177\355\0\0\0{\0\0\0\"\0\0\0"
955 +  "\11\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\371"
956 +  "\371\371\377\360\360\360\377\346\346\346\377\337\337\337\377\333\333"
957 +  "\333\377\327\327\327\377\236\236\236\374{{{\355\0\0\0{\0\0\0\"\0\0\0"
958 +  "\11\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\365\365\365"
959 +  "\377\355\355\355\377\342\342\342\377\333\333\333\377\330\330\330\377"
960 +  "\325\325\325\377\317\317\317\377\227\227\227\374vvv\355\0\0\0{\0\0\0"
961 +  "\"\0\0\0\11\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\361\361\361"
962 +  "\377\350\350\350\377\335\335\335\377\326\326\326\377\324\324\324\377"
963 +  "\317\317\317\377\307\307\307\377\277\277\277\377\216\216\216\374qqq\352"
964 +  "\0\0\0r\0\0\0\33\0\0\0\11\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0`\353"
965 +  "\353\353\377\340\340\340\377\324\324\324\377\317\317\317\377\315\315"
966 +  "\315\377\307\307\307\377\274\274\274\377\257\257\257\377\212\212\212"
967 +  "\375ggg\357\\\\\\\313\0\0\0F\0\0\0\24\0\0\0\11\0\0\0\3\0\0\0\1\0\0\0"
968 +  "\0\0\0\0`\340\340\340\377\321\321\321\377\305\305\305\377\304\304\304"
969 +  "\377\307\307\307\377\302\302\302\377\242\242\242\376HHH\361\0\0\0\267"
970 +  "\0\0\0\224\0\0\0t\0\0\0?\0\0\0\"\0\0\0\22\0\0\0\7\0\0\0\2\0\0\0\0\0\0"
971 +  "\0]\321\321\321\377\277\277\277\377\207\207\207\374jjj\367\302\302\302"
972 +  "\377\301\301\301\377\263\263\263\377!!!\334\0\0\0\215\0\0\0d\0\0\0Q\0"
973 +  "\0\0>\0\0\0-\0\0\0\33\0\0\0\14\0\0\0\4\0\0\0\1\0\0\0E\230\230\230\363"
974 +  "kkk\353\0\0\0\243\0\0\0\254\200\200\200\370\304\304\304\377\271\271\271"
975 +  "\377ttt\371\0\0\0\233\0\0\0Y\0\0\0F\0\0\0<\0\0\0.\0\0\0\36\0\0\0\16\0"
976 +  "\0\0\4\0\0\0\1\0\0\0\7\0\0\0M\0\0\0]\0\0\0O\0\0\0f'''\305\304\304\304"
977 +  "\377\274\274\274\377\253\253\253\377\22\22\22\277\0\0\0e\0\0\0A\0\0\0"
978 +  "3\0\0\0%\0\0\0\27\0\0\0\13\0\0\0\4\0\0\0\1\0\0\0\0\0\0\0\3\0\0\0\24\0"
979 +  "\0\0)\0\0\0<\0\0\0\207\223\223\223\373\267\267\267\377\252\252\252\377"
980 +  "YYY\360\0\0\0\203\0\0\0@\0\0\0+\0\0\0\32\0\0\0\15\0\0\0\6\0\0\0\2\0\0"
981 +  "\0\0\0\0\0\0\0\0\0\2\0\0\0\11\0\0\0\27\0\0\0'\0\0\0N===\312\257\257\257"
982 +  "\377\242\242\242\377lll\370\0\0\0\221\0\0\0E\0\0\0)\0\0\0\26\0\0\0\11"
983 +  "\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\15\0\0\0\26\0"
984 +  "\0\0\33\0\0\0\\CCC\322ppp\366MMM\345\0\0\0\204\0\0\0I\0\0\0-\0\0\0\31"
985 +  "\0\0\0\12\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\5\0\0"
986 +  "\0\11\0\0\0\13\0\0\0\20\0\0\0E\0\0\0s\0\0\0w\0\0\0Z\0\0\0E\0\0\0""2\0"
987 +  "\0\0\35\0\0\0\14\0\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
988 +  "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\12\0\0\0\36\0\0\0""4\0\0\0>\0\0\0"
989 +  "<\0\0\0""1\0\0\0\36\0\0\0\15\0\0\0\4\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0"
990 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\4\0\0\0\15\0\0\0\33\0"
991 +  "\0\0)\0\0\0.\0\0\0(\0\0\0\31\0\0\0\13\0\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0"
992 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\6\0\0"
993 +  "\0\15\0\0\0\26\0\0\0\33\0\0\0\30\0\0\0\17\0\0\0\7\0\0\0\2\0\0\0\0\0\0"
994 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
995 +  "\0\0\0\1\0\0\0\4\0\0\0\10\0\0\0\13\0\0\0\12\0\0\0\6\0\0\0\3\0\0\0\1\0"
996 +  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
997 +  "\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\2\0\0\0\3\0\0\0\3\0\0\0\1\0\0\0\1\0"
998 +  "\0\0\0\0\0\0\0\0\0\0\0";
999 +
1000 +static DFBSurfaceDescription arrow_desc = {
1001 +  flags                   : DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT |
1002 +                            DSDESC_PREALLOCATED,
1003 +  width                   : 18,
1004 +  height                  : 25,
1005 +  pixelformat             : DSPF_ARGB,
1006 +  preallocated : {{  data : (void *) arrow_data,
1007 +                    pitch : 72  }}
1008 +};
1009 +
1010 +#define arrow_hot_x 1
1011 +#define arrow_hot_y 1
1012 diff -uraN ../links-2.1pre9/drivers.c ./drivers.c
1013 --- ../links-2.1pre9/drivers.c  2002-10-12 21:46:24.000000000 +0200
1014 +++ ./drivers.c 2003-03-13 15:06:01.000000000 +0100
1015 @@ -22,6 +22,9 @@
1016  #ifdef GRDRV_FB
1017  extern struct graphics_driver fb_driver;
1018  #endif
1019 +#ifdef GRDRV_DIRECTFB
1020 +extern struct graphics_driver directfb_driver;
1021 +#endif
1022  #ifdef GRDRV_PMSHELL
1023  extern struct graphics_driver pmshell_driver;
1024  #endif
1025 @@ -39,6 +42,9 @@
1026  #ifdef GRDRV_X
1027         &x_driver,
1028  #endif
1029 +#ifdef GRDRV_DIRECTFB
1030 +       &directfb_driver,
1031 +#endif
1032  #ifdef GRDRV_SVGALIB
1033         &svga_driver,
1034  #endif
1035 diff -uraN ../links-2.1pre9/img.c ./img.c
1036 --- ../links-2.1pre9/img.c      2003-02-20 14:01:12.000000000 +0100
1037 +++ ./img.c     2003-03-13 15:06:01.000000000 +0100
1038 @@ -514,11 +514,11 @@
1039                tmpbmp.data=(unsigned char *)cimg->bmp.data+cimg->bmp.skip*yoff;
1040                add1=cimg->bmp.skip*max_height;
1041         }
1042 -       tmpbmp.skip=cimg->bmp.skip;
1043         add2=cimg->buffer_bytes_per_pixel*cimg->width*max_height;
1044  not_enough:
1045         tmpbmp.y=height<max_height?height:max_height;
1046         if (use_strip) tmpbmp.data=drv->prepare_strip(&(cimg->bmp),yoff,tmpbmp.y);
1047 +       tmpbmp.skip=cimg->bmp.skip;
1048         buffer_to_16(tmp, cimg, buffer, tmpbmp.y);
1049         if (dregs){
1050                 dither_restart(tmp, &tmpbmp, dregs);
1051 diff -uraN ../links-2.1pre9/os_dep.c ./os_dep.c
1052 --- ../links-2.1pre9/os_dep.c   2003-01-10 23:13:49.000000000 +0100
1053 +++ ./os_dep.c  2003-03-13 15:06:01.000000000 +0100
1054 @@ -1182,7 +1182,7 @@
1055                 fn(ptr, p[1]);
1056                 write(p[1], "x", 1);
1057                 close(p[1]);
1058 -               exit(0);
1059 +               _exit(0);
1060         }
1061         if (f == -1) {
1062                 close(p[0]);
This page took 0.101089 seconds and 3 git commands to generate.