XLFDs should be well-formed (14 hyphens) to match scalable fonts.
[wine] / graphics / x11drv / objects.c
1 /*
2  * GDI objects
3  *
4  * Copyright 1993 Alexandre Julliard
5  */
6
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include "bitmap.h"
10 #include "brush.h"
11 #include "font.h"
12 #include "pen.h"
13 #include "debug.h"
14
15
16 extern HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
17                                              BITMAPOBJ * bmp );
18 extern HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
19                                            BRUSHOBJ * brush );
20 extern HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont,
21                                          FONTOBJ * font );
22 extern HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
23
24 extern BOOL32 X11DRV_BITMAP_DeleteObject( HBITMAP32 hbitmap, BITMAPOBJ *bmp );
25
26 /***********************************************************************
27  *           X11DRV_SelectObject
28  */
29 HGDIOBJ32 X11DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
30 {
31     GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
32     HGDIOBJ32 ret = 0;
33
34     if (!ptr) return 0;
35     TRACE(gdi, "hdc=%04x %04x\n", dc->hSelf, handle );
36     
37     switch(ptr->wMagic)
38     {
39       case PEN_MAGIC:
40           ret = X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
41           break;
42       case BRUSH_MAGIC:
43           ret = X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
44           break;
45       case BITMAP_MAGIC:
46           ret = X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
47           break;
48       case FONT_MAGIC:
49           ret = X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );   
50           break;
51       case REGION_MAGIC:
52           ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
53           break;
54     }
55     GDI_HEAP_UNLOCK( handle );
56     return ret;
57 }
58
59
60 /***********************************************************************
61  *           X11DRV_DeleteObject
62  */
63 BOOL32 X11DRV_DeleteObject( HGDIOBJ32 handle )
64 {
65     GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
66     BOOL32 ret = 0;
67
68     if (!ptr) return FALSE;
69      
70     switch(ptr->wMagic) {
71     case BITMAP_MAGIC:
72         ret = X11DRV_BITMAP_DeleteObject( handle, (BITMAPOBJ *)ptr );
73         break;
74
75     default:
76         ERR(gdi, "Shouldn't be here!\n");
77         ret = FALSE;
78         break;
79     }
80     GDI_HEAP_UNLOCK( handle );
81     return ret;
82 }