comparison src/scrollbar-x.c @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents c5d627a313b1
children e11d67e05968
comparison
equal deleted inserted replaced
281:090b52736db2 282:c42ec1d1cded
290 /* with Motif scrollbars (it is apparently needed with Lesstif). */ 290 /* with Motif scrollbars (it is apparently needed with Lesstif). */
291 XtUngrabKeyboard (SCROLLBAR_X_WIDGET (instance), CurrentTime); 291 XtUngrabKeyboard (SCROLLBAR_X_WIDGET (instance), CurrentTime);
292 #endif 292 #endif
293 XtUnmanageChild (SCROLLBAR_X_WIDGET (instance)); 293 XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
294 } 294 }
295 }
296
297 /* A device method. */
298 static void
299 x_scrollbar_width_changed_in_frame (Lisp_Object specifier, struct frame *f,
300 Lisp_Object oldval)
301 {
302 XtWidgetGeometry req, repl;
303 Lisp_Object newval = f->scrollbar_width;
304
305 in_specifier_change_function++;
306
307 /* We want the text area to stay the same size. So, we query the
308 current size and then adjust it for the change in the scrollbar
309 width. */
310
311 /* mirror the value in the frame resources, unless it was already
312 done. */
313 if (!in_resource_setting)
314 Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), XtNscrollBarWidth, XINT (newval));
315
316 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f)))
317 {
318 req.request_mode = 0;
319
320 /* the query-geometry method looks at the current value of
321 f->scrollbar_width, so temporarily set it back to the old
322 one. */
323 f->scrollbar_width = oldval;
324 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
325 f->scrollbar_width = newval;
326
327 repl.width += XINT (newval) - XINT (oldval);
328 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
329 repl.height);
330 }
331
332 in_specifier_change_function--;
333 }
334
335 /* A device method. */
336 static void
337 x_scrollbar_height_changed_in_frame (Lisp_Object specifier, struct frame *f,
338 Lisp_Object oldval)
339 {
340 XtWidgetGeometry req, repl;
341 Lisp_Object newval = f->scrollbar_height;
342
343 in_specifier_change_function++;
344
345 /* We want the text area to stay the same size. So, we query the
346 current size and then adjust it for the change in the scrollbar
347 height. */
348
349 /* mirror the value in the frame resources, unless it was already
350 done. Also don't do it if this is the when the frame is being
351 created -- the widgets don't even exist yet, and even if they
352 did, we wouldn't want to overwrite the resource information
353 (which might specify a user preference). */
354 if (!in_resource_setting)
355 Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), XtNscrollBarHeight, XINT (newval));
356
357 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f)))
358 {
359 req.request_mode = 0;
360
361 /* the query-geometry method looks at the current value of
362 f->scrollbar_height, so temporarily set it back to the old
363 one. */
364 f->scrollbar_height = oldval;
365 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
366 f->scrollbar_height = newval;
367
368 repl.height += XINT (newval) - XINT (oldval);
369 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
370 repl.height);
371 }
372
373 in_specifier_change_function--;
374 } 295 }
375 296
376 enum x_scrollbar_loop 297 enum x_scrollbar_loop
377 { 298 {
378 X_FIND_SCROLLBAR_WINDOW_MIRROR, 299 X_FIND_SCROLLBAR_WINDOW_MIRROR,
815 CONSOLE_HAS_METHOD (x, free_scrollbar_instance); 736 CONSOLE_HAS_METHOD (x, free_scrollbar_instance);
816 CONSOLE_HAS_METHOD (x, release_scrollbar_instance); 737 CONSOLE_HAS_METHOD (x, release_scrollbar_instance);
817 CONSOLE_HAS_METHOD (x, create_scrollbar_instance); 738 CONSOLE_HAS_METHOD (x, create_scrollbar_instance);
818 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_values); 739 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_values);
819 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_status); 740 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_status);
820 CONSOLE_HAS_METHOD (x, scrollbar_width_changed_in_frame);
821 CONSOLE_HAS_METHOD (x, scrollbar_height_changed_in_frame);
822 CONSOLE_HAS_METHOD (x, scrollbar_pointer_changed_in_window); 741 CONSOLE_HAS_METHOD (x, scrollbar_pointer_changed_in_window);
823 #ifdef MEMORY_USAGE_STATS 742 #ifdef MEMORY_USAGE_STATS
824 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage); 743 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage);
825 #endif /* MEMORY_USAGE_STATS */ 744 #endif /* MEMORY_USAGE_STATS */
826 } 745 }