// File: jkingan[P]ladyheather/heather.cpp
// Function: x11_resize_check()
void x11_resize_check()
{
int mach;

   // if X11 screen, check if screen has been re-sized
   mach = 0;
   #ifdef __MACH__
      mach = 0;     // !!!! testing
   #endif

#ifdef USE_X11
   if(have_restore_size == 0) {
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
      restore_width = SCREEN_WIDTH;
      restore_height= SCREEN_HEIGHT;
      have_restore_size = 1;   // size came from initial screen init
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
   }

   if(need_resize && (this_button == 0) && (last_button == 0)) {
if(show_debug_info) printf("resizing screen:%dx%d\n", SCREEN_WIDTH,SCREEN_HEIGHT);
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
if(show_debug_info) printf("RESIZE to %dx%d  now:%dx%d  have_root:%d  mach:%d\n", new_width,new_height, SCREEN_WIDTH,SCREEN_HEIGHT, have_root_info, mach); // zork - show_debug_info
      need_resize = 0;
      if(new_width < MIN_WIDTH) new_width = MIN_WIDTH;
      if(new_width > MAX_WIDTH) new_width = MAX_WIDTH;
      if(new_height < MIN_HEIGHT) new_height = MIN_HEIGHT;


      if(mach || (new_width != SCREEN_WIDTH) || (new_height != SCREEN_HEIGHT)) {
         if(have_root_info && ((unsigned)(new_width+2) < display_width) && ((unsigned) (new_height+0) < display_height)) { // new window size is not near the screen size
            restore_width = new_width;
            restore_height = new_height;
            have_restore_size = 3;  // size came from resize event
            x11_maxed = 0;
if(show_debug_info) printf("new restore size 3: %dx%d\n", restore_width,restore_height); // zork - show_debug_infi
         }

         SCREEN_WIDTH = custom_width = new_width;
         SCREEN_HEIGHT = custom_height = new_height;
if(show_debug_info) printf("Resizing to %d x %d.\n", SCREEN_WIDTH,SCREEN_HEIGHT); // zork - show_debug_info
         screen_type = 'c';
//       strcpy(edit_buffer, "c");
         sprintf(edit_buffer, "%dx%d",SCREEN_WIDTH,SCREEN_HEIGHT);
         if(display) XFlush(display);
         keyboard_cmd = 1;
         edit_screen_res();
         keyboard_cmd = 0;
      }
      else SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
   }
#endif  // USE_X11
#if USE_SDL
       if(0 == sdl_scaling && need_resize && (this_button == 0) && (last_button == 0)) {
           printf("RESIZE to %dx%d  now:%dx%d  have_root:%d  mach:%d\n", new_width,new_height, SCREEN_WIDTH,SCREEN_HEIGHT, have_root_info, mach); // zork - show_debug_info
           need_resize = 0;
           restore_width = new_width;
           restore_height = new_height;
           have_restore_size = 3;  // size came from resize event
           SCREEN_WIDTH = custom_width = new_width;
           SCREEN_HEIGHT = custom_height = new_height;
           if(show_debug_info) printf("Resizing to %d x %d.\n", SCREEN_WIDTH,SCREEN_HEIGHT); // zork - show_debug_info
           screen_type = 'c';
           sprintf(edit_buffer, "%dx%d",SCREEN_WIDTH,SCREEN_HEIGHT);
           keyboard_cmd = 1;
           edit_screen_res();
           keyboard_cmd = 0;
       }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x0, 0x1a310a(%rip)    # 0x1d0090
jne 0x2d006
cmpl $0x0, 0x24aa79(%rip)    # 0x277a08
je 0x2cfb5
movl 0x24aa4d(%rip), %eax    # 0x2779e4
movl %eax, 0x24aa6f(%rip)    # 0x277a0c
movl 0x24aa3d(%rip), %eax    # 0x2779e0
movl %eax, 0x24aa3b(%rip)    # 0x2779e4
movl 0x24aa5d(%rip), %eax    # 0x277a0c
movl %eax, 0x24aa2b(%rip)    # 0x2779e0
movl 0x24aa25(%rip), %eax    # 0x2779e0
movl %eax, 0x1a30d3(%rip)    # 0x1d0094
movl 0x24aa1d(%rip), %eax    # 0x2779e4
movl %eax, 0x1a30cb(%rip)    # 0x1d0098
movl $0x1, 0x1a30b9(%rip)    # 0x1d0090
cmpl $0x0, 0x24aa2a(%rip)    # 0x277a08
je 0x2d004
movl 0x24a9fe(%rip), %eax    # 0x2779e4
movl %eax, 0x24aa20(%rip)    # 0x277a0c
movl 0x24a9ee(%rip), %eax    # 0x2779e0
movl %eax, 0x24a9ec(%rip)    # 0x2779e4
movl 0x24aa0e(%rip), %eax    # 0x277a0c
movl %eax, 0x24a9dc(%rip)    # 0x2779e0
jmp 0x2d006
cmpl $0x0, 0x24aa1f(%rip)    # 0x277a2c
je 0x2d273
cmpl $0x0, 0x24d422(%rip)    # 0x27a43c
jne 0x2d273
cmpl $0x0, 0x24d419(%rip)    # 0x27a440
jne 0x2d273
cmpb $0x0, 0x24aa70(%rip)    # 0x277aa4
je 0x2d050
movl 0x24a9a4(%rip), %esi    # 0x2779e0
movl 0x24a9a2(%rip), %edx    # 0x2779e4
leaq 0x1443fe(%rip), %rdi    # 0x171447
movb $0x0, %al
callq 0x9030
cmpl $0x0, 0x24a9b1(%rip)    # 0x277a08
je 0x2d07d
movl 0x24a985(%rip), %eax    # 0x2779e4
movl %eax, 0x24a9a7(%rip)    # 0x277a0c
movl 0x24a975(%rip), %eax    # 0x2779e0
movl %eax, 0x24a973(%rip)    # 0x2779e4
movl 0x24a995(%rip), %eax    # 0x277a0c
movl %eax, 0x24a963(%rip)    # 0x2779e0
cmpb $0x0, 0x24aa20(%rip)    # 0x277aa4
je 0x2d0ba
movl 0x24a9a4(%rip), %esi    # 0x277a30
movl 0x24a9a2(%rip), %edx    # 0x277a34
movl 0x24a948(%rip), %ecx    # 0x2779e0
movl 0x24a945(%rip), %r8d    # 0x2779e4
movl 0x1a2fe6(%rip), %r9d    # 0x1d008c
movl -0x4(%rbp), %eax
leaq 0x1443ae(%rip), %rdi    # 0x17145e
movl %eax, (%rsp)
movb $0x0, %al
callq 0x9030
movl $0x0, 0x24a968(%rip)    # 0x277a2c
cmpl $0x140, 0x24a962(%rip)  # imm = 0x140
jge 0x2d0da
movl $0x140, 0x24a956(%rip)  # imm = 0x140
cmpl $0x1000, 0x24a94c(%rip) # imm = 0x1000
jle 0x2d0f0
movl $0x1000, 0x24a940(%rip) # imm = 0x1000
cmpl $0x140, 0x24a93a(%rip)  # imm = 0x140
jge 0x2d106
movl $0x140, 0x24a92e(%rip)  # imm = 0x140
cmpl $0x0, -0x4(%rbp)
jne 0x2d12c
movl 0x24a91e(%rip), %eax    # 0x277a30
cmpl 0x24a8c8(%rip), %eax    # 0x2779e0
jne 0x2d12c
movl 0x24a914(%rip), %eax    # 0x277a34
cmpl 0x24a8be(%rip), %eax    # 0x2779e4
je 0x2d242
cmpl $0x0, 0x1a2f59(%rip)    # 0x1d008c
je 0x2d1a8
movl 0x24a8f5(%rip), %eax    # 0x277a30
addl $0x2, %eax
cmpl 0x24a894(%rip), %eax    # 0x2779d8
jae 0x2d1a8
movl 0x24a8e8(%rip), %eax    # 0x277a34
addl $0x0, %eax
cmpl 0x24a887(%rip), %eax    # 0x2779dc
jae 0x2d1a8
movl 0x24a8d3(%rip), %eax    # 0x277a30
movl %eax, 0x1a2f31(%rip)    # 0x1d0094
movl 0x24a8cb(%rip), %eax    # 0x277a34
movl %eax, 0x1a2f29(%rip)    # 0x1d0098
movl $0x3, 0x1a2f17(%rip)    # 0x1d0090
movl $0x0, 0x1a2f19(%rip)    # 0x1d009c
cmpb $0x0, 0x24a91a(%rip)    # 0x277aa4
je 0x2d1a6
movl 0x1a2f02(%rip), %esi    # 0x1d0094
movl 0x1a2f00(%rip), %edx    # 0x1d0098
leaq 0x1442f2(%rip), %rdi    # 0x171491
movb $0x0, %al
callq 0x9030
jmp 0x2d1a8
movl 0x24a882(%rip), %eax    # 0x277a30
movl %eax, 0x24a844(%rip)    # 0x2779f8
movl %eax, 0x24a826(%rip)    # 0x2779e0
movl 0x24a874(%rip), %eax    # 0x277a34
movl %eax, 0x24a836(%rip)    # 0x2779fc
movl %eax, 0x24a818(%rip)    # 0x2779e4
cmpb $0x0, 0x24a8d1(%rip)    # 0x277aa4
je 0x2d1ef
movl 0x24a805(%rip), %esi    # 0x2779e0
movl 0x24a803(%rip), %edx    # 0x2779e4
leaq 0x1442c4(%rip), %rdi    # 0x1714ac
movb $0x0, %al
callq 0x9030
movb $0x63, 0x24a81b(%rip)   # 0x277a11
movl 0x24a7e4(%rip), %edx    # 0x2779e0
movl 0x24a7e2(%rip), %ecx    # 0x2779e4
leaq 0x3712b7(%rip), %rdi    # 0x39e4c0
leaq 0x143b45(%rip), %rsi    # 0x170d55
movb $0x0, %al
callq 0x9060
cmpq $0x0, 0x1a2e81(%rip)    # 0x1d00a0
je 0x2d22d
movq 0x1a2e78(%rip), %rdi    # 0x1d00a0
callq 0x95b0
movb $0x1, 0x33fe18(%rip)    # 0x36d04c
callq 0x49c40
movb $0x0, 0x33fe0c(%rip)    # 0x36d04c
jmp 0x2d271
cmpl $0x0, 0x24a7bf(%rip)    # 0x277a08
je 0x2d26f
movl 0x24a793(%rip), %eax    # 0x2779e4
movl %eax, 0x24a7b5(%rip)    # 0x277a0c
movl 0x24a783(%rip), %eax    # 0x2779e0
movl %eax, 0x24a781(%rip)    # 0x2779e4
movl 0x24a7a3(%rip), %eax    # 0x277a0c
movl %eax, 0x24a771(%rip)    # 0x2779e0
jmp 0x2d271
jmp 0x2d273
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)