~ubuntu-branches/ubuntu/natty/mutter/natty

« back to all changes in this revision

Viewing changes to .pc/03_strict_focus.patch/src/core/window.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-11-30 10:56:20 UTC
  • Revision ID: james.westby@ubuntu.com-20101130105620-5pg8qjx4fn4nt00b
Tags: 2.91.3-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
3158
3158
    }
3159
3159
}
3160
3160
 
 
3161
/**
 
3162
 * meta_window_get_maximized:
 
3163
 *
 
3164
 * Gets the current maximization state of the window, as combination
 
3165
 * of the %META_MAXIMIZE_HORIZONTAL and %META_MAXIMIZE_VERTICAL flags;
 
3166
 *
 
3167
 * Return value: current maximization state
 
3168
 */
 
3169
MetaMaximizeFlags
 
3170
meta_window_get_maximized (MetaWindow *window)
 
3171
{
 
3172
  return ((window->maximized_horizontally ? META_MAXIMIZE_HORIZONTAL : 0) |
 
3173
          (window->maximized_vertically ? META_MAXIMIZE_VERTICAL : 0));
 
3174
}
 
3175
 
 
3176
/**
 
3177
 * meta_window_is_fullscreen:
 
3178
 *
 
3179
 * Return value: %TRUE if the window is currently fullscreen
 
3180
 */
 
3181
gboolean
 
3182
meta_window_is_fullscreen (MetaWindow *window)
 
3183
{
 
3184
  return window->fullscreen;
 
3185
}
 
3186
 
3161
3187
static void
3162
3188
meta_window_tile (MetaWindow *window)
3163
3189
{
9275
9301
  return FALSE;
9276
9302
}
9277
9303
 
 
9304
/**
 
9305
 * meta_window_appears_focused:
 
9306
 * @window: a #MetaWindow
 
9307
 *
 
9308
 * Determines if the window should be drawn with a focused appearance. This is
 
9309
 * true for focused windows but also true for windows with a focused modal
 
9310
 * dialog attached.
 
9311
 *
 
9312
 * Return value: %TRUE if the window should be drawn with a focused frame
 
9313
 */
9278
9314
gboolean
9279
9315
meta_window_appears_focused (MetaWindow *window)
9280
9316
{
 
9317
  /* FIXME: meta_window_foreach_transient() iterates over all windows; we
 
9318
   *  should eat the complexity to cache a bit for this.
 
9319
   */
9281
9320
  if (!window->has_focus && meta_prefs_get_attach_modal_dialogs ())
9282
9321
    {
9283
9322
      gboolean focus = FALSE;
9655
9694
 
9656
9695
  return window->mutter_hints;
9657
9696
}
 
9697
 
 
9698
/**
 
9699
 * meta_window_get_frame_type:
 
9700
 * @window: a #MetaWindow
 
9701
 *
 
9702
 * Gets the type of window decorations that should be used for this window.
 
9703
 *
 
9704
 * Return value: the frame type
 
9705
 */
 
9706
MetaFrameType
 
9707
meta_window_get_frame_type (MetaWindow *window)
 
9708
{
 
9709
  MetaFrameType base_type = META_FRAME_TYPE_LAST;
 
9710
 
 
9711
  switch (window->type)
 
9712
    {
 
9713
    case META_WINDOW_NORMAL:
 
9714
      base_type = META_FRAME_TYPE_NORMAL;
 
9715
      break;
 
9716
 
 
9717
    case META_WINDOW_DIALOG:
 
9718
      base_type = META_FRAME_TYPE_DIALOG;
 
9719
      break;
 
9720
 
 
9721
    case META_WINDOW_MODAL_DIALOG:
 
9722
      if (meta_prefs_get_attach_modal_dialogs () &&
 
9723
          meta_window_get_transient_for (window) != NULL)
 
9724
        base_type = META_FRAME_TYPE_ATTACHED;
 
9725
      else
 
9726
        base_type = META_FRAME_TYPE_MODAL_DIALOG;
 
9727
      break;
 
9728
 
 
9729
    case META_WINDOW_MENU:
 
9730
      base_type = META_FRAME_TYPE_MENU;
 
9731
      break;
 
9732
 
 
9733
    case META_WINDOW_UTILITY:
 
9734
      base_type = META_FRAME_TYPE_UTILITY;
 
9735
      break;
 
9736
 
 
9737
    case META_WINDOW_DESKTOP:
 
9738
    case META_WINDOW_DOCK:
 
9739
    case META_WINDOW_TOOLBAR:
 
9740
    case META_WINDOW_SPLASHSCREEN:
 
9741
    case META_WINDOW_DROPDOWN_MENU:
 
9742
    case META_WINDOW_POPUP_MENU:
 
9743
    case META_WINDOW_TOOLTIP:
 
9744
    case META_WINDOW_NOTIFICATION:
 
9745
    case META_WINDOW_COMBO:
 
9746
    case META_WINDOW_DND:
 
9747
    case META_WINDOW_OVERRIDE_OTHER:
 
9748
      /* No frame */
 
9749
      base_type = META_FRAME_TYPE_LAST;
 
9750
      break;
 
9751
    }
 
9752
 
 
9753
  if (base_type == META_FRAME_TYPE_LAST)
 
9754
    {
 
9755
      /* can't add border if undecorated */
 
9756
      return META_FRAME_TYPE_LAST;
 
9757
    }
 
9758
  else if (window->border_only && base_type != META_FRAME_TYPE_ATTACHED)
 
9759
    {
 
9760
      /* override base frame type */
 
9761
      return META_FRAME_TYPE_BORDER;
 
9762
    }
 
9763
  else
 
9764
    {
 
9765
      return base_type;
 
9766
    }
 
9767
}