~ubuntu-branches/ubuntu/trusty/vice/trusty

« back to all changes in this revision

Viewing changes to src/arch/unix/x11/ui-resources.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2013-07-28 20:38:23 UTC
  • mfrom: (1.2.5)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: package-import@ubuntu.com-20130728203823-w495rps5wuykespp
Tags: upstream-2.4.dfsg
ImportĀ upstreamĀ versionĀ 2.4.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <stdio.h>
32
32
 
33
33
#include "lib.h"
 
34
#include "machine.h"
34
35
#include "resources.h"
35
36
#include "log.h"
36
37
#include "ui.h"
42
43
    int save_resources_on_exit;
43
44
    int confirm_on_exit;
44
45
    int depth;
45
 
    int window_width;
46
 
    int window_height;
 
46
    int window0_width;
 
47
    int window0_height;
 
48
    int window0_xpos;
 
49
    int window0_ypos;
 
50
    int window1_width;
 
51
    int window1_height;
 
52
    int window1_xpos;
 
53
    int window1_ypos;
47
54
#if defined (USE_XF86_EXTENSIONS) && \
48
55
    (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
49
56
    int fs_enabled_pending;
67
74
    return 0;
68
75
}
69
76
 
70
 
static int set_width(int d, void *param)
71
 
{
72
 
    /* Minimal sanity check.  */
73
 
    if (d < 0) {
74
 
        return -1;
75
 
    }
76
 
 
77
 
    ui_resources.window_width = d;
78
 
    return 0;
79
 
}
80
 
 
81
 
static int set_height(int d, void *param)
82
 
{
83
 
    /* Minimal sanity check.  */
84
 
    if (d < 0) {
85
 
        return -1;
86
 
    }
87
 
 
88
 
    ui_resources.window_height = d;
 
77
static int set_width0(int d, void *param)
 
78
{
 
79
    /* Minimal sanity check.  */
 
80
    if (d < 0) {
 
81
        return -1;
 
82
    }
 
83
 
 
84
    ui_resources.window0_width = d;
 
85
    return 0;
 
86
}
 
87
 
 
88
static int set_height0(int d, void *param)
 
89
{
 
90
    /* Minimal sanity check.  */
 
91
    if (d < 0) {
 
92
        return -1;
 
93
    }
 
94
 
 
95
    ui_resources.window0_height = d;
 
96
    return 0;
 
97
}
 
98
 
 
99
static int set_xpos0(int d, void *param)
 
100
{
 
101
    ui_resources.window0_xpos = d;
 
102
    return 0;
 
103
}
 
104
 
 
105
static int set_ypos0(int d, void *param)
 
106
{
 
107
    ui_resources.window0_ypos = d;
 
108
    return 0;
 
109
}
 
110
 
 
111
static int set_width1(int d, void *param)
 
112
{
 
113
    /* Minimal sanity check.  */
 
114
    if (d < 0) {
 
115
        return -1;
 
116
    }
 
117
 
 
118
    ui_resources.window1_width = d;
 
119
    return 0;
 
120
}
 
121
 
 
122
static int set_height1(int d, void *param)
 
123
{
 
124
    /* Minimal sanity check.  */
 
125
    if (d < 0) {
 
126
        return -1;
 
127
    }
 
128
 
 
129
    ui_resources.window1_height = d;
 
130
    return 0;
 
131
}
 
132
 
 
133
static int set_xpos1(int d, void *param)
 
134
{
 
135
    ui_resources.window1_xpos = d;
 
136
    return 0;
 
137
}
 
138
 
 
139
static int set_ypos1(int d, void *param)
 
140
{
 
141
    ui_resources.window1_ypos = d;
89
142
    return 0;
90
143
}
91
144
 
134
187
}
135
188
#endif
136
189
 
 
190
/*
 
191
    FIXME: WindowXXX should be per window (for x128)
 
192
*/
137
193
static const resource_int_t resources_int[] = {
138
194
    { "PrivateColormap", 0, RES_EVENT_NO, NULL,
139
195
      &ui_resources.use_private_colormap, set_use_private_colormap, NULL },
143
199
      &ui_resources.confirm_on_exit, set_confirm_on_exit, NULL },
144
200
    { "DisplayDepth", 0, RES_EVENT_NO, NULL,
145
201
      &ui_resources.depth, set_depth, NULL },
146
 
    { "WindowWidth", 0, RES_EVENT_NO, NULL,
147
 
      &ui_resources.window_width, set_width, NULL },
148
 
    { "WindowHeight", 0, RES_EVENT_NO, NULL,
149
 
      &ui_resources.window_height, set_height, NULL },
 
202
    { "Window0Width", 0, RES_EVENT_NO, NULL,
 
203
      &ui_resources.window0_width, set_width0, NULL },
 
204
    { "Window0Height", 0, RES_EVENT_NO, NULL,
 
205
      &ui_resources.window0_height, set_height0, NULL },
 
206
    { "Window0Xpos", -1, RES_EVENT_NO, NULL,
 
207
      &ui_resources.window0_xpos, set_xpos0, NULL },
 
208
    { "Window0Ypos", -1, RES_EVENT_NO, NULL,
 
209
      &ui_resources.window0_ypos, set_ypos0, NULL },
150
210
#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
151
211
    { "UseFullscreen", 0, RES_EVENT_NO, NULL,
152
212
      &ui_resources.fs_enabled_pending, fullscreen_set_fs, NULL },
154
214
    { NULL }
155
215
};
156
216
 
 
217
static const resource_int_t extra_resources_int[] = {
 
218
    { "Window1Width", 0, RES_EVENT_NO, NULL,
 
219
      &ui_resources.window1_width, set_width1, NULL },
 
220
    { "Window1Height", 0, RES_EVENT_NO, NULL,
 
221
      &ui_resources.window1_height, set_height1, NULL },
 
222
    { "Window1Xpos", -1, RES_EVENT_NO, NULL,
 
223
      &ui_resources.window1_xpos, set_xpos1, NULL },
 
224
    { "Window1Ypos", -1, RES_EVENT_NO, NULL,
 
225
      &ui_resources.window1_ypos, set_ypos1, NULL },
 
226
    { NULL }
 
227
};
 
228
 
157
229
int ui_resources_init(void)
158
230
{
159
231
    ui_resources_initialized = 1;
162
234
        return -1;
163
235
    }
164
236
 
 
237
    if (machine_class == VICE_MACHINE_C128) {
 
238
        if (resources_register_int(extra_resources_int) < 0) {
 
239
            return -1;
 
240
        }
 
241
    }
 
242
 
165
243
    return resources_register_int(resources_int);
166
244
}
167
245