~ubuntu-branches/ubuntu/trusty/netrek-client-cow/trusty

« back to all changes in this revision

Viewing changes to x11window.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese
  • Date: 2009-06-16 15:27:20 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090616152720-whngeaf1w8l23u14
Tags: 3.3.0-1
[ Barry deFreese ]
* New upstream release.
* Install upstream desktop file. (Closes: #522587).
* Add quilt patch system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* x11window.c
2
 
 * 
 
2
 *
3
3
 * Kevin P. Smith  6/11/89 Much modified by Jerry Frain and Joe Young
4
4
 *
5
5
 */
204
204
#endif
205
205
 
206
206
static W_Event W_myevent;
207
 
static int W_isEvent = 0;
 
207
static int W_isEvent = 0; /* an event is being held here for the caller */
208
208
 
209
209
struct fontInfo
210
210
  {
440
440
  GetFonts();
441
441
  GetColors();
442
442
 
443
 
#ifdef HAVE_XPM
444
 
  GetPixmaps(W_Display, &myroot);
445
 
#endif
446
 
 
447
443
  /* display scroll thumb */
448
444
  scrollbar = booleanDefault("ScrollBar", scrollbar);
449
445
  scroll_lines = intDefault("ScrollSaveLines", scroll_lines);
452
448
#ifdef BEEPLITE
453
449
  init_tts();
454
450
#endif
455
 
  W_FullScreenInitialise();
 
451
}
 
452
 
 
453
void W_GetPixmaps(W_Window t, W_Window g)
 
454
{
 
455
  GetPixmaps(W_Display, &myroot, t, g);
456
456
}
457
457
 
458
458
/* Make sure the font will work, ie: that it fits in the 6x10 character cell
941
941
#endif
942
942
 
943
943
  gcheck_result = checkGeometry(name, &x, &y, &width, &height);
944
 
  /* printf("%s.geometry: %d %d %d %d %d\n", name, x, y, width, height, *
945
 
   * gcheck_result); */
946
944
  checkParent(name, &parent);
947
945
  wparent = W_Void2Window(parent)->window;
948
946
  attrs.border_pixel = colortable[color].pixelValue;
955
953
#ifdef MOTION_MOUSE
956
954
  attrs.event_mask |= ButtonMotionMask;
957
955
#endif
958
 
  //  if (!strcmp(name, "netrek")) {
959
 
  //    attrs.event_mask |= StructureNotifyMask;
960
 
  //  }
961
 
 
962
956
 
963
957
  if (strcmp(name, "netrek_icon") == 0)          /* icon should not select *
964
958
                                                  * for input */
968
962
  newwin = newWindow(
969
963
              XCreateWindow(W_Display, wparent, x, y, width, height, border,
970
964
                            CopyFromParent, InputOutput, CopyFromParent,
971
 
                            CWBackPixel | CWEventMask |
972
 
                            CWBorderPixel,
 
965
                            CWBackPixel | CWEventMask | CWBorderPixel,
973
966
                            &attrs),
974
967
                      WIN_GRAPH);
975
968
 
1024
1017
  class_hint.res_name = name;
1025
1018
  XSetClassHint(W_Display, newwin->window, &class_hint);
1026
1019
  XSetWMHints(W_Display, newwin->window, &wm_hint);
1027
 
 
1028
 
  if (wparent == W_Root && baseWin != NULL && strcmp(name, "wait") != 0
1029
 
      && strcmp(name, "waitmotd") != 0)
1030
 
    XSetTransientForHint(W_Display, newwin->window, W_Void2Window(baseWin)->window);
1031
1020
  newwin->name = strdup(name);
1032
1021
  newwin->width = width;
1033
1022
  newwin->height = height;
2013
2002
  XSetWMNormalHints(W_Display, newwin->window, sz_hints);
2014
2003
  XSetClassHint(W_Display, newwin->window, &class_hint);
2015
2004
  XSetWMHints(W_Display, newwin->window, &wm_hint);
2016
 
  if (wparent == W_Root && baseWin != NULL)
2017
 
    XSetTransientForHint(W_Display, newwin->window, W_Void2Window(baseWin)->window);
2018
2005
  newwin->name = strdup(name);
2019
2006
  newwin->width = width;
2020
2007
  newwin->height = height;
2148
2135
  XFree((void *) sz_hints);
2149
2136
  XSetClassHint(W_Display, newwin->window, &class_hint);
2150
2137
  XSetWMHints(W_Display, newwin->window, &wm_hint);
2151
 
  if (wparent == W_Root && baseWin != NULL)
2152
 
    XSetTransientForHint(W_Display, newwin->window, W_Void2Window(baseWin)->window);
2153
 
 
2154
2138
  newwin->name = strdup(name);
2155
2139
  sw = (struct scrollingWindow *) malloc(sizeof(struct scrollingWindow));
2156
2140
 
2427
2411
  class_hint.res_name = name;
2428
2412
  XSetClassHint(W_Display, newwin->window, &class_hint);
2429
2413
  XSetWMHints(W_Display, newwin->window, &wm_hint);
2430
 
  if (wparent == W_Root && baseWin != NULL)
2431
 
    XSetTransientForHint(W_Display, newwin->window, W_Void2Window(baseWin)->window);
2432
2414
  XStoreName(W_Display, newwin->window, name);
2433
2415
  newwin->name = strdup(name);
2434
2416
  items = (struct menuItem *) malloc(height * sizeof(struct menuItem));
3026
3008
  free((char *) win);
3027
3009
}
3028
3010
 
3029
 
/* NOT USED */
3030
 
void
3031
 
        W_SetTransientForHint(W_Window w, W_Window pw)
3032
 
{
3033
 
  XSetTransientForHint(W_Display, W_Void2Window(w)->window,
3034
 
                       W_Void2Window(pw)->window);
3035
 
}
3036
 
 
3037
 
 
3038
3011
void deleteWindow(struct window *window)
3039
3012
{
3040
3013
  struct windowlist **rm;
3419
3392
 
3420
3393
 
3421
3394
{
3422
 
  Window  win = W_Void2Window(window)->window;
 
3395
  struct window *w = W_Void2Window(window);
3423
3396
  XSizeHints *sz_hints;
3424
3397
 
3425
3398
  sz_hints = XAllocSizeHints();
3426
 
  sz_hints->min_width = (unsigned int) neww;
3427
 
  sz_hints->max_width = (unsigned int) neww;
3428
 
  sz_hints->min_height = (unsigned int) newh;
3429
 
  sz_hints->max_height = (unsigned int) newh;
 
3399
  sz_hints->min_width = neww;
 
3400
  sz_hints->max_width = neww;
 
3401
  sz_hints->min_height = newh;
 
3402
  sz_hints->max_height = newh;
3430
3403
  sz_hints->flags = PMinSize | PMaxSize;
3431
 
  XSetWMNormalHints(W_Display, win, sz_hints);
3432
 
  XResizeWindow(W_Display, win, (unsigned int) neww, (unsigned int) newh);
 
3404
  XSetWMNormalHints(W_Display, w->window, sz_hints);
 
3405
  XResizeWindow(W_Display, w->window, neww, newh);
3433
3406
}
3434
3407
 
3435
3408
void
3668
3641
}
3669
3642
#endif
3670
3643
 
3671
 
#ifdef HAVE_XPM
3672
3644
void    W_Halo(int x, int y, W_Color color)
3673
3645
{
3674
3646
  struct window *win = W_Void2Window(mapw);
3682
3654
               mplanet_width, mplanet_height, 0, 23040);
3683
3655
    }
3684
3656
}
3685
 
#endif /* HAVE_XPM */
3686
3657
 
3687
3658
void W_CameraSnap(W_Window window)
3688
3659
{
3791
3762
  Window child;
3792
3763
  XTranslateCoordinates(W_Display, win->window, W_Root, 0, 0, &tx, &ty, &child);
3793
3764
  XF86VidModeSetViewPort(W_Display, W_Screen, tx, ty);
3794
 
  XMoveResizeWindow(W_Display, win->window, 0, 0, 1024, 768);
3795
3765
  XMapRaised(W_Display, win->window);
3796
3766
  XRaiseWindow(W_Display, win->window);
3797
3767
}
3811
3781
                 win->window, None, CurrentTime);
3812
3782
  XGrabKeyboard(W_Display, win->window, True, GrabModeAsync,
3813
3783
                GrabModeAsync, CurrentTime);
 
3784
  XFlush(W_Display);
3814
3785
}
3815
3786
 
3816
3787
static void pointer_grab_off(W_Window window)
3824
3795
  Atom WM_HINTS;
3825
3796
  WM_HINTS = XInternAtom(W_Display, "_NET_WM_STATE", True);
3826
3797
  if (WM_HINTS != None) {
3827
 
    Atom p[1]; 
 
3798
    Atom p[1];
3828
3799
    p[0] = XInternAtom(W_Display, "_NET_WM_STATE_FULLSCREEN", True);
3829
3800
    XChangeProperty(W_Display, win->window, WM_HINTS, XA_ATOM, 32,
3830
3801
                    PropModeReplace, (unsigned char *)p, 1);
3844
3815
 
3845
3816
void W_FullScreenOn(W_Window window)
3846
3817
{
 
3818
  struct window *win = W_Void2Window(window);
3847
3819
#ifdef FULLSCREEN
3848
3820
#if DEBUG > 0
3849
3821
  fprintf(stderr, "W_FullScreenOn\n");
3850
3822
#endif
 
3823
  XResizeWindow(W_Display, win->window, 1024, 768);
 
3824
  pointer_grab_on(window);
3851
3825
  video_mode_on();
3852
3826
  view_port_warp(window);
3853
 
  pointer_grab_on(window);
3854
3827
  kde_fullscreen_on(window);
3855
3828
#endif
3856
3829
}
3875
3848
  full_screen_enabled = 0;
3876
3849
  full_screen_default = 0;
3877
3850
  if (booleanDefault("FullScreen", 0)) {
3878
 
    // FIXME: when this is on in .xtrekrc normal resolution may not be restored
3879
3851
    full_screen_default++;
3880
3852
    if (video_mode_initialise())
3881
3853
      full_screen_enabled++;