title: How do I handle mouse events in general in Imgui with glfw?
body: <p>I used the glfw callback function to move the camera with the mouse.</p>
  <p>mouse callback function is:</p>
  <pre class="lang-cpp prettyprint-override"><code>void mouse_callback(GLFWwindow *window, double xposIn, double yposIn)
  {
      if (is_pressed)
      {
          camera.ProcessMouseMovement((static_cast&lt;float&gt;(yposIn) - prev_mouse.y) / 3.6f, (static_cast&lt;float&gt;(xposIn) - prev_mouse.x) / 3.6f);
          prev_mouse.x = xposIn;
          prev_mouse.y = yposIn;
      }
      cur_mouse.x = xposIn;
      cur_mouse.y = yposIn;
  }
  
  void mouse_btn_callback(GLFWwindow *window, int button, int action, int mods)
  {
      if (button == GLFW_MOUSE_BUTTON_LEFT &amp;&amp; action == GLFW_PRESS)
      {
          prev_mouse.x = cur_mouse.x;
          prev_mouse.y = cur_mouse.y;
          is_pressed = true;
      }
      else
      {
          is_pressed = false;
      }
  }
  </code></pre>
  <p>However, in this case, the camera will move even when operated in other imgui windows as shown below.</p>
  <p><img src="https://blog.kakaocdn.net/dn/cPyWaK/btrx077o3gC/pQw9CasQFFPEMC8pbTulkK/img.gif" alt="" /></p>
  <p>I don't know how to handle this.</p>
  <p>Should I put this logic between begin and end of IMGUI, using something like <code>ImGui::IsWindowHovered()</code>?</p>
  <p>like this:</p>
  <pre class="lang-cpp prettyprint-override"><code>ImGui::Begin(&quot;scene&quot;);
  {
      if(ImGui::IsWindowHovered())
      {
          //camera setting    
      }
  }
  ImGui::End()
  </code></pre>