/* make sure a maximized window and it's normal version are never a page or * more apart. */ void maximize_adjust_offset(MvwmWindow *fw) { int off_x; int off_y; int dh; int dw; struct monitor *m = fw->m; if (!IS_MAXIMIZED(fw)) { /* otherwise we might corrupt the g.normal */ return; } off_x = fw->g.normal.x - fw->g.max.x - fw->g.max_offset.x; off_y = fw->g.normal.y - fw->g.max.y - fw->g.max_offset.y; dw = m->coord.w; dh = m->coord.h; if (off_x >= dw) { fw->g.normal.x -= (off_x / dw) * dw; } else if (off_x <= -dw) { fw->g.normal.x += (-off_x / dw) * dw; } if (off_y >= dh) { fw->g.normal.y -= (off_y / dh) * dh; } else if (off_y <= -dh) { fw->g.normal.y += (-off_y / dh) * dh; } return; }
void get_unshaded_geometry( MvwmWindow *fw, rectangle *ret_g) { struct monitor *m = fw->m; if (IS_SHADED(fw)) { if (IS_MAXIMIZED(fw)) { *ret_g = fw->g.max; } else { *ret_g = fw->g.normal; } get_relative_geometry(m, ret_g, ret_g); } else { *ret_g = fw->g.frame; } return; }
void list_configure(unsigned long *body) { struct ConfigWinPacket *cfgpacket = (void *)body; char *grav; printf( "0x%08lx %-20s x %ld, y %ld, width %ld, height %ld\n", cfgpacket->w, "frame", cfgpacket->frame_x, cfgpacket->frame_y, cfgpacket->frame_width, cfgpacket->frame_height ); printf( "0x%08lx %-20s %ld\n" ,cfgpacket->w, "desktop", cfgpacket->desk); /* Oooh, you asked for it... */ if (Opt_flags == 2) { printf( "Packet flags\n" ); printf( "is_sticky_across_pages: %d\n", IS_STICKY_ACROSS_PAGES( cfgpacket ) ); printf( "is_sticky_across_desks: %d\n", IS_STICKY_ACROSS_DESKS( cfgpacket ) ); printf( "has_icon_font: %d\n", HAS_ICON_FONT( cfgpacket ) ); printf( "has_window_font: %d\n", HAS_WINDOW_FONT( cfgpacket ) ); printf( "do_circulate_skip: %d\n", DO_SKIP_CIRCULATE( cfgpacket ) ); printf( "do_circulate_skip_icon: %d\n", DO_SKIP_ICON_CIRCULATE( cfgpacket ) ); printf( "do_circulate_skip_shaded: %d\n", DO_SKIP_SHADED_CIRCULATE( cfgpacket ) ); printf( "do_grab_focus_when_created: %d\n", FP_DO_GRAB_FOCUS( FW_FOCUS_POLICY(cfgpacket) ) ); printf( "do_grab_focus_when_transient_created: %d\n", FP_DO_GRAB_FOCUS_TRANSIENT( FW_FOCUS_POLICY(cfgpacket) ) ); printf( "do_ignore_restack: %d\n", DO_IGNORE_RESTACK( cfgpacket ) ); printf( "do_lower_transient: %d\n", DO_LOWER_TRANSIENT( cfgpacket ) ); printf( "do_not_show_on_map: %d\n", DO_NOT_SHOW_ON_MAP( cfgpacket ) ); printf( "do_not_pass_click_focus_click: %d\n", FP_DO_PASS_FOCUS_CLICK( FW_FOCUS_POLICY(cfgpacket) ) ); printf( "do_raise_transient: %d\n", DO_RAISE_TRANSIENT( cfgpacket ) ); printf( "do_resize_opaque: %d\n", DO_RESIZE_OPAQUE( cfgpacket ) ); printf( "do_shrink_windowshade: %d\n", DO_SHRINK_WINDOWSHADE( cfgpacket ) ); printf( "do_stack_transient_parent: %d\n", DO_STACK_TRANSIENT_PARENT( cfgpacket ) ); printf( "do_window_list_skip: %d\n", DO_SKIP_WINDOW_LIST( cfgpacket ) ); printf( "has_depressable_border: %d\n", HAS_DEPRESSABLE_BORDER( cfgpacket ) ); printf( "has_mwm_border: %d\n", HAS_MWM_BORDER( cfgpacket ) ); printf( "has_mwm_buttons: %d\n", HAS_MWM_BUTTONS( cfgpacket ) ); printf( "has_mwm_override: %d\n", HAS_MWM_OVERRIDE_HINTS( cfgpacket ) ); printf( "has_no_icon_title: %d\n", HAS_NO_ICON_TITLE( cfgpacket ) ); printf( "has_override_size: %d\n", HAS_OVERRIDE_SIZE_HINTS( cfgpacket ) ); printf( "has_stippled_title: %d\n", HAS_STIPPLED_TITLE( cfgpacket ) ); printf( "is_fixed: %d\n", IS_FIXED( cfgpacket ) ); printf( "is_icon_sticky_across_pages: %d\n", IS_ICON_STICKY_ACROSS_PAGES( cfgpacket ) ); printf( "is_icon_sticky_across_desks: %d\n", IS_ICON_STICKY_ACROSS_DESKS( cfgpacket ) ); printf( "is_icon_suppressed: %d\n", IS_ICON_SUPPRESSED( cfgpacket ) ); printf( "is_lenient: %d\n", FP_IS_LENIENT( FW_FOCUS_POLICY(cfgpacket) ) ); printf( "does_wm_delete_window: %d\n", WM_DELETES_WINDOW( cfgpacket ) ); printf( "does_wm_take_focus: %d\n", WM_TAKES_FOCUS( cfgpacket ) ); printf( "do_iconify_after_map: %d\n", DO_ICONIFY_AFTER_MAP( cfgpacket ) ); printf( "do_reuse_destroyed: %d\n", DO_REUSE_DESTROYED( cfgpacket ) ); printf( "has_border: %d\n", !HAS_NO_BORDER( cfgpacket ) ); printf( "has_title: %d\n", HAS_TITLE( cfgpacket ) ); printf( "is_iconify_pending: %d\n", IS_ICONIFY_PENDING( cfgpacket ) ); printf( "is_fully_visible: %d\n", IS_FULLY_VISIBLE( cfgpacket ) ); printf( "is_iconified: %d\n", IS_ICONIFIED( cfgpacket ) ); printf( "is_iconfied_by_parent: %d\n", IS_ICONIFIED_BY_PARENT( cfgpacket ) ); printf( "is_icon_entered: %d\n", IS_ICON_ENTERED( cfgpacket ) ); printf( "is_icon_font_loaded: %d\n", IS_ICON_FONT_LOADED( cfgpacket ) ); printf( "is_icon_moved: %d\n", IS_ICON_MOVED( cfgpacket ) ); printf( "is_icon_ours: %d\n", IS_ICON_OURS( cfgpacket ) ); printf( "is_icon_shaped: %d\n", IS_ICON_SHAPED( cfgpacket ) ); printf( "is_icon_unmapped: %d\n", IS_ICON_UNMAPPED( cfgpacket ) ); printf( "is_mapped: %d\n", IS_MAPPED( cfgpacket ) ); printf( "is_map_pending: %d\n", IS_MAP_PENDING( cfgpacket ) ); printf( "is_maximized: %d\n", IS_MAXIMIZED( cfgpacket ) ); printf( "is_name_changed: %d\n", IS_NAME_CHANGED( cfgpacket ) ); printf( "is_partially_visible: %d\n", IS_PARTIALLY_VISIBLE( cfgpacket ) ); printf( "is_pixmap_ours: %d\n", IS_PIXMAP_OURS( cfgpacket ) ); printf( "is_size_inc_set: %d\n", IS_SIZE_INC_SET( cfgpacket ) ); printf( "is_transient: %d\n", IS_TRANSIENT( cfgpacket ) ); printf( "is_window_drawn_once: %d\n", cfgpacket->flags.is_window_drawn_once ); printf( "is_viewport_moved: %d\n", IS_VIEWPORT_MOVED( cfgpacket ) ); printf( "is_window_being_moved_opaque: %d\n", IS_WINDOW_BEING_MOVED_OPAQUE( cfgpacket ) ); printf( "is_window_font_loaded: %d\n", IS_WINDOW_FONT_LOADED( cfgpacket ) ); printf( "is_window_shaded %d\n", IS_SHADED( cfgpacket ) ); printf( "title_dir: %d\n", GET_TITLE_DIR( cfgpacket ) ); } printf( "0x%08lx %-20s %hd\n", cfgpacket->w, "title height", cfgpacket->title_height); printf( "0x%08lx %-20s %hd\n", cfgpacket->w, "border width", cfgpacket->border_width); printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "base size", cfgpacket->hints_base_width, cfgpacket->hints_base_height); printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "size increment", cfgpacket->hints_width_inc, cfgpacket->hints_height_inc); printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "min size", cfgpacket->hints_min_width, cfgpacket->hints_min_height); printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "max size", cfgpacket->hints_max_width, cfgpacket->hints_max_height); switch(cfgpacket->hints_win_gravity) { case ForgetGravity: grav = "Forget"; break; case NorthWestGravity: grav = "NorthWest"; break; case NorthGravity: grav = "North"; break; case NorthEastGravity: grav = "NorthEast"; break; case WestGravity: grav = "West"; break; case CenterGravity: grav = "Center"; break; case EastGravity: grav = "East"; break; case SouthWestGravity: grav = "SouthWest"; break; case SouthGravity: grav = "South"; break; case SouthEastGravity: grav = "SouthEast"; break; case StaticGravity: grav = "Static"; break; default: grav = "Unknown"; break; } printf( "0x%08lx %-20s %s\n", cfgpacket->w, "gravity", grav); printf( "0x%08lx %-20s text 0x%lx, back 0x%lx\n", cfgpacket->w, "pixel", cfgpacket->TextPixel, cfgpacket->BackPixel); }
/* * * Procedure: * constrain_size - adjust the given width and height to account for the * constraints imposed by size hints */ void constrain_size( FvwmWindow *fw, const XEvent *e, int *widthp, int *heightp, int xmotion, int ymotion, int flags) { size_rect min; size_rect max; size_rect inc; size_rect base; size_rect round_up; size_rect d; size_rect old; size_borders b; if (DO_DISABLE_CONSTRAIN_SIZE_FULLSCREEN(fw) == 1) { return; } if (HAS_NEW_WM_NORMAL_HINTS(fw)) { /* get the latest size hints */ XSync(dpy, 0); GetWindowSizeHints(fw); SET_HAS_NEW_WM_NORMAL_HINTS(fw, 0); } if (IS_MAXIMIZED(fw) && (flags & CS_UPDATE_MAX_DEFECT)) { *widthp += fw->g.max_defect.width; *heightp += fw->g.max_defect.height; } /* gcc 4.1.1 warns about these not being initialized at the end, * but the conditions for the use are the same...*/ old.width = *widthp; old.height = *heightp; d.width = *widthp; d.height = *heightp; get_window_borders(fw, &b); d.width -= b.total_size.width; d.height -= b.total_size.height; min.width = fw->hints.min_width; min.height = fw->hints.min_height; if (min.width < fw->min_window_width - b.total_size.width) { min.width = fw->min_window_width - b.total_size.width; } if (min.height < fw->min_window_height - b.total_size.height) { min.height = fw->min_window_height - b.total_size.height; } max.width = fw->hints.max_width; max.height = fw->hints.max_height; if (max.width > fw->max_window_width - b.total_size.width) { max.width = fw->max_window_width - b.total_size.width; } if (max.height > fw->max_window_height - b.total_size.height) { max.height = fw->max_window_height - b.total_size.height; } if (min.width > max.width) { min.width = max.width; } if (min.height > max.height) { min.height = max.height; } base.width = fw->hints.base_width; base.height = fw->hints.base_height; inc.width = fw->hints.width_inc; inc.height = fw->hints.height_inc; /* * First, clamp to min and max values */ if (d.width < min.width) { d.width = min.width; } if (d.height < min.height) { d.height = min.height; } if (d.width > max.width) { d.width = max.width; } if (d.height > max.height) { d.height = max.height; } /* * Second, round to base + N * inc (up or down depending on resize * type) if rounding up store amount */ if (!(flags & CS_ROUND_UP)) { d.width = ((d.width - base.width) / inc.width) * inc.width + base.width; d.height = ((d.height - base.height) / inc.height) * inc.height + base.height; } else { round_up.width = d.width; round_up.height = d.height; d.width = ((d.width - base.width + inc.width - 1) / inc.width) * inc.width + base.width; d.height = ((d.height - base.height + inc.height - 1) / inc.height) * inc.height + base.height; round_up.width = d.width - round_up.width; round_up.height = d.height - round_up.height; } /* * Step 2a: check we didn't move the edge off screen in interactive * moves */ if ((flags & CS_ROUND_UP) && e != NULL && e->type == MotionNotify) { if (xmotion > 0 && e->xmotion.x_root < round_up.width) { d.width -= inc.width; } else if ( xmotion < 0 && e->xmotion.x_root >= Scr.MyDisplayWidth - round_up.width) { d.width -= inc.width; } if (ymotion > 0 && e->xmotion.y_root < round_up.height) { d.height -= inc.height; } else if ( ymotion < 0 && e->xmotion.y_root >= Scr.MyDisplayHeight - round_up.height) { d.height -= inc.height; } } /* * Step 2b: Check that we didn't violate min and max. */ if (d.width < min.width) { d.width += inc.width; } if (d.height < min.height) { d.height += inc.height; } if (d.width > max.width) { d.width -= inc.width; } if (d.height > max.height) { d.height -= inc.height; } /* * Third, adjust for aspect ratio */ if (fw->hints.flags & PAspect) { __cs_handle_aspect_ratio( &d, fw, d, base, inc, min, max, xmotion, ymotion, flags); } /* * Fourth, account for border width and title height */ *widthp = d.width + b.total_size.width; *heightp = d.height + b.total_size.height; if (IS_MAXIMIZED(fw) && (flags & CS_UPDATE_MAX_DEFECT)) { /* update size defect for maximized window */ fw->g.max_defect.width = old.width - *widthp; fw->g.max_defect.height = old.height - *heightp; } return; }