[2229] in SIPB bug reports

home help back first fref pref prev next nref lref last post

Re: RS/6000 patches to xscreensaver [fix]

daemon@ATHENA.MIT.EDU (lwvanels@Athena.MIT.EDU)
Sat Nov 2 16:46:29 1991

From: lwvanels@Athena.MIT.EDU
Date: Sat, 2 Nov 91 16:45:27 -0500
To: lwvanels@Athena.MIT.EDU
Cc: bug-sipb@Athena.MIT.EDU
In-Reply-To: [2228]
Reply-To: lwvanels@mit.edu

Whups- I sent that previous message out too soon; there's a several bugs in
those previous patch.  First of all, the copyrights on the two new
files- ignore them.  Copywrite 'em as you wish, jik, they're all yours.

There's one additional issue, as well- disable_hft_hotkey() now returns an
int; if it is non-zero, it encountered an error that prevented it from
disabling the switching.  I wasn't sure how best to integrate that back into
the top level error handling.

----------------------------------------------------------------------------
*** /tmp/,RCSt1QQABXj	Sat Nov  2 16:40:54 1991
--- hft.c	Sat Nov  2 16:35:04 1991
***************
*** 47,65 ****
       become the active (visible) one.
  */
  
- static int
- find_valid_hft()
- {
-   int i, fd;
- 
-   if ((fd = open("/dev/hft",O_RDONLY,0)) < 0) {
-     perror("opening hft");
-     return;
-   }
-   return fd;
- }
- 
- 
  void
  enable_hft_hotkey()
  {
--- 39,44 ----
***************
*** 69,75 ****
    if (!hft_locked)
      return;
  
!   if ((fd = find_valid_hft()) < 0) {
      perror("opening hft");
      return;
    }
--- 48,54 ----
    if (!hft_locked)
      return;
  
!   if ((fd = open("/dev/hft",O_RDONLY,0)) < 0) {
      perror("opening hft");
      return;
    }
***************
*** 85,93 ****
        
    }
    close(fd);
  }
  
! void
  disable_hft_hotkey()
  {
    int fd, i;
--- 64,73 ----
        
    }
    close(fd);
+   hft_locked = 0;
  }
  
! int
  disable_hft_hotkey()
  {
    int fd, i;
***************
*** 96,120 ****
    hft_buffer.hf_bufp = (char *) &orig_hft_state;
    hft_buffer.hf_buflen = sizeof(struct hftqstat);
  
!   if ((fd = find_valid_hft()) < 0) {
      perror("opening hft");
!     return;
    }
  
    if (ioctl(fd, HFTQSMGR, &hft_buffer) != 0) {
      perror("ioctl: HFTQSMGR failed");
      close(fd);
!     return;
    }
  
    for (i=0; i<(orig_hft_state.hf_numvts -1); i++) {
      hft_cmd.hf_vtid = orig_hft_state.hf_vtinfo[i].hf_vtid;
      hft_cmd.hf_cmd = SMHIDE;
! 
!     if (ioctl(fd, HFTCSMGR, &hft_cmd) != 0)
        perror("ioctl: HFTCSMGR failed");
!       
    }
    close(fd);
    hft_locked = 1;
  }
--- 76,103 ----
    hft_buffer.hf_bufp = (char *) &orig_hft_state;
    hft_buffer.hf_buflen = sizeof(struct hftqstat);
  
!   if ((fd = open("/dev/hft",O_RDONLY,0)) < 0) {
      perror("opening hft");
!     return -1;
    }
  
    if (ioctl(fd, HFTQSMGR, &hft_buffer) != 0) {
      perror("ioctl: HFTQSMGR failed");
      close(fd);
!     return -1;
    }
  
    for (i=0; i<(orig_hft_state.hf_numvts -1); i++) {
      hft_cmd.hf_vtid = orig_hft_state.hf_vtinfo[i].hf_vtid;
      hft_cmd.hf_cmd = SMHIDE;
!     if (ioctl(fd, HFTCSMGR, &hft_cmd) != 0) { 
        perror("ioctl: HFTCSMGR failed");
!       close(fd);
!       enable_hft_hotkey();
!       return -1;
!     }
    }
    close(fd);
    hft_locked = 1;
+   return 0;
  }

home help back first fref pref prev next nref lref last post