Enlightenment CVS committal

Author  : gilbertt
Project : misc
Module  : feh

Dir     : misc/feh/src


Modified Files:
        events.c menu.c options.c options.h winwidget.c 


Log Message:
Geometry setting tweaks.

Also, a patch from Maciej Kalisiak <[EMAIL PROTECTED]>
    - large image/zoom bugfix


===================================================================
RCS file: /cvsroot/enlightenment/misc/feh/src/events.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- events.c    23 Feb 2003 16:35:45 -0000      1.68
+++ events.c    2 Jul 2004 21:06:14 -0000       1.69
@@ -149,15 +149,18 @@
             winwid->im_x = (scr_width - winwid->im_w) >> 1;
             winwid->im_y = (scr_height - winwid->im_h) >> 1;
          }
-         else if (opt.geom)
-         {
-            winwid->im_x = (opt.geom_w - winwid->im_w) >> 1;
-            winwid->im_y = (opt.geom_h - winwid->im_h) >> 1;
-         }
          else
          {
-            winwid->im_x = 0;
-            winwid->im_y = 0;
+           if (opt.geom_flags & WidthValue) {
+             winwid->im_x = (opt.geom_w - winwid->im_w) >> 1;
+           } else {
+             winwid->im_x = 0;
+           }
+           if (opt.geom_flags & HeightValue) {
+             winwid->im_y = (opt.geom_h - winwid->im_h) >> 1;
+           } else {
+              winwid->im_y = 0;
+           }
          }
          if (winwid->im_click_offset_x < 30)
             winwid->im_click_offset_x = 30;
@@ -356,7 +359,7 @@
             w->w = ev->xconfigure.width;
             w->h = ev->xconfigure.height;
             w->had_resize = 1;
-            if (opt.geom)
+            if (opt.geom_flags & WidthValue || opt.geom_flags & HeightValue)
             {
                opt.geom_w = w->w;
                opt.geom_h = w->h;
@@ -558,7 +561,7 @@
             winwid->im_w = gib_imlib_image_get_width(temp);
             winwid->im_h = gib_imlib_image_get_height(temp);
             gib_imlib_free_image_and_decache(temp);
-            if (!winwid->full_screen && !opt.geom)
+            if (!winwid->full_screen && !opt.geom_flags)
                winwidget_resize(winwid, winwid->im_w, winwid->im_h);
             winwid->has_rotated = 1;
          }
===================================================================
RCS file: /cvsroot/enlightenment/misc/feh/src/menu.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- menu.c      11 Apr 2003 10:39:38 -0000      1.59
+++ menu.c      2 Jul 2004 21:06:15 -0000       1.60
@@ -1927,7 +1927,7 @@
                             opt.auto_zoom);
   feh_menu_add_toggle_entry(mm, "Freeze Window Size", NULL, NULL,
                             feh_menu_cb_opt_freeze_window, NULL, NULL,
-                            opt.geom);
+                            opt.geom_flags);
   feh_menu_add_toggle_entry(mm, "Fullscreen", NULL, NULL,
                             feh_menu_cb_opt_fullscreen, NULL, NULL,
                             m->fehwin->full_screen);
@@ -2050,11 +2050,12 @@
 {
   MENU_ITEM_TOGGLE(i);
   if (MENU_ITEM_IS_ON(i)) {
-    opt.geom = TRUE;
+    opt.geom_flags = (WidthValue | HeightValue);
     opt.geom_w = m->fehwin->w;
     opt.geom_h = m->fehwin->h;
-  } else
-    opt.geom = FALSE;
+  } else {
+    opt.geom_flags = 0;
+  }
 }
 
 static void
===================================================================
RCS file: /cvsroot/enlightenment/misc/feh/src/options.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -3 -r1.153 -r1.154
--- options.c   4 Jan 2004 00:14:13 -0000       1.153
+++ options.c   2 Jul 2004 21:06:15 -0000       1.154
@@ -397,6 +397,7 @@
       {0, 0, 0, 0}
    };
    int optch = 0, cmdx = 0, i = 0;
+   int geomret;
 
    D_ENTER(4);
 
@@ -461,9 +462,7 @@
            opt.reverse = 1;
            break;
         case 'g':
-           XParseGeometry(optarg, &i, &i, &opt.geom_w, &opt.geom_h);
-           if ((opt.geom_w > 1) && (opt.geom_h > 1))
-              opt.geom = 1;
+           opt.geom_flags = XParseGeometry(optarg, &opt.geom_x, &opt.geom_y, 
&opt.geom_w, &opt.geom_h);
            break;
         case 'N':
            opt.no_menus = 1;
===================================================================
RCS file: /cvsroot/enlightenment/misc/feh/src/options.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- options.h   11 Apr 2003 10:39:38 -0000      1.40
+++ options.h   2 Jul 2004 21:06:16 -0000       1.41
@@ -97,7 +97,6 @@
    unsigned char no_rotate_ctrl_mask;
    unsigned char no_blur_ctrl_mask;
    unsigned char no_pan_ctrl_mask;
-   unsigned char geom;
 
    int thumb_w;
    int thumb_h;
@@ -106,6 +105,9 @@
    int reload;
    int sort;
    int debug_level;
+   int geom_flags;
+   int geom_x;
+   int geom_y;
    int geom_w;
    int geom_h;
    int default_zoom;
===================================================================
RCS file: /cvsroot/enlightenment/misc/feh/src/winwidget.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -3 -r1.117 -r1.118
--- winwidget.c 4 Jan 2004 00:14:13 -0000       1.117
+++ winwidget.c 2 Jul 2004 21:06:16 -0000       1.118
@@ -160,6 +160,8 @@
   XClassHint *xch;
   MWMHints mwmhints;
   Atom prop = None;
+  int x = 0;
+  int y = 0;
 
   D_ENTER(4);
 
@@ -173,9 +175,27 @@
       h = xinerama_screens[xinerama_screen].height;
     }
 #endif /* HAVE_LIBXINERAMA */
-  } else if (opt.geom) {
-    w = opt.geom_w;
-    h = opt.geom_h;
+  } else if (opt.geom_flags) {
+    if (opt.geom_flags & WidthValue) {
+      w = opt.geom_w;
+    }
+    if (opt.geom_flags & HeightValue) {
+      h = opt.geom_h;
+    }
+    if (opt.geom_flags & XValue) {
+      if (opt.geom_flags & XNegative) {
+        x = scr->width - opt.geom_x;
+      } else {
+        x = opt.geom_x;
+      }
+    }
+    if (opt.geom_flags & YValue) {
+      if (opt.geom_flags & YNegative) {
+        y = scr->height - opt.geom_y;
+      } else {
+        y = opt.geom_y;
+      }
+    }
   } else if (opt.screen_clip) {
     if (w > scr->width)
       w = scr->width;
@@ -192,8 +212,8 @@
 #endif /* HAVE_LIBXINERAMA */
   }
 
-  ret->x = 0;
-  ret->y = 0;
+  ret->x = x;
+  ret->y = y;
   ret->w = w;
   ret->h = h;
   ret->visible = False;
@@ -225,7 +245,7 @@
     mwmhints.flags = 0;
 
   ret->win =
-    XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, w, h, 0, depth,
+    XCreateWindow(disp, DefaultRootWindow(disp), x, y, w, h, 0, depth,
                   InputOutput, vis,
                   CWOverrideRedirect | CWSaveUnder | CWBackingStore |
                   CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
@@ -245,14 +265,14 @@
   XFree(xch);
 
   /* Size hints */
-  if (ret->full_screen) {
+  if (ret->full_screen || opt.geom_flags) {
     XSizeHints xsz;
 
     xsz.flags = USPosition;
-    xsz.x = 0;
-    xsz.y = 0;
+    xsz.x = x;
+    xsz.y = y;
     XSetWMNormalHints(disp, ret->win, &xsz);
-    XMoveWindow(disp, ret->win, 0, 0);
+    XMoveWindow(disp, ret->win, x, y);
   }
 
   /* set the icon name property */
@@ -338,7 +358,7 @@
   winwidget_setup_pixmaps(winwid);
 
   if (!winwid->full_screen
-      && ((gib_imlib_image_has_alpha(winwid->im)) || (opt.geom)
+      && ((gib_imlib_image_has_alpha(winwid->im)) || (opt.geom_flags)
           || (winwid->im_x || winwid->im_y) || (winwid->zoom != 1.0)
           || (winwid->w > winwid->im_w || winwid->h > winwid->im_h)
           || (winwid->has_rotated)))
@@ -354,7 +374,7 @@
                      winwid->im_h * winwid->zoom);
   }
 
-  if (resize && (winwid->full_screen || opt.geom)) {
+  if (resize && (winwid->full_screen || opt.geom_flags)) {
     int smaller;                /* Is the image smaller than screen? */
     int max_w, max_h;
 
@@ -367,9 +387,13 @@
         max_h = xinerama_screens[xinerama_screen].height;
       }
 #endif /* HAVE_LIBXINERAMA */
-    } else if (opt.geom) {
-      max_w = opt.geom_w;
-      max_h = opt.geom_h;
+    } else {
+      if (opt.geom_flags & WidthValue) {
+        max_w = opt.geom_w;
+      }
+      if (opt.geom_flags & HeightValue) {
+        max_h = opt.geom_h;
+      }
     }
 
     D(4, ("Calculating for fullscreen/fixed geom render\n"));
@@ -442,21 +466,16 @@
   if (dy < 0)
     dy = 0;
 
-  if (winwid->im_x < 0) {
-    if (winwid->zoom < 1.0)
-      sx = 0 - (winwid->im_x * winwid->zoom);
-    else
-      sx = 0 - (winwid->im_x / winwid->zoom);
-  } else
+  if (winwid->im_x < 0)
+    sx = 0 - (winwid->im_x / winwid->zoom);
+  else
     sx = 0;
 
-  if (winwid->im_y < 0) {
-    if (winwid->zoom < 1.0)
-      sy = 0 - (winwid->im_y * winwid->zoom);
-    else
-      sy = 0 - (winwid->im_y / winwid->zoom);
-  } else
+  if (winwid->im_y < 0)
+    sy = 0 - (winwid->im_y / winwid->zoom);
+  else
     sy = 0;
+  
   calc_w = winwid->im_w * winwid->zoom;
   calc_h = winwid->im_h * winwid->zoom;
   dw = (winwid->w - winwid->im_x);
@@ -755,7 +774,7 @@
                  int h)
 {
   D_ENTER(4);
-  if (opt.geom) {
+  if (opt.geom_flags) {
     winwid->had_resize = 1;
     return;
   }




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to